-- UI elements


local intro = script.Parent:WaitForChild("Intro")
intro.Visible = true

local tokensLabel = script.Parent:WaitForChild("Tokens") -- textlabel
local tokens = game.Players.LocalPlayer:WaitForChild("Tokens") -- value


wait(2)

game.Workspace.Camera.CameraType = Enum.CameraType.Scriptable
game.Workspace.Camera.CFrame = CFrame.new(game.Workspace.IntroTunnel.CameraOrigin.Position,game.Workspace.IntroTunnel.CameraFace.Position)

local topStatus = script.Parent:WaitForChild("TopStatus")
topStatus.Text = status.Value

status:GetPropertyChangedSignal("Value"):Connect(function()
	topStatus.Text = status.Value
end)

tokensLabel.Text = tokens.Value
tokens:GetPropertyChangedSignal("Value"):Connect(function()
	tokensLabel.Text = tokens.Value
end)

intro.Play.MouseButton1Click:Connect(function()
	
	if game.ReplicatedStorage.MapVoting.Value == true then
		script.Parent.MapVoting.Visible = true
	end
	
	intro.Visible = false
	topStatus.Visible = true
	game.ReplicatedStorage.MenuPlay:FireServer()
	game.Workspace.Camera.CameraType = Enum.CameraType.Custom
end)

game.ReplicatedStorage.KillFeed.OnClientEvent:Connect(function(text)
	script.Parent.KillFeed.Visible = true
	script.Parent.KillFeed.Text = text
	wait(2)
	script.Parent.KillFeed.Visible = false
end)

game.ReplicatedStorage.Announcement.OnClientEvent:Connect(function(text)
	script.Parent.Announcement.Text = text
	script.Parent.Announcement.Visible = true
	wait(5)
	script.Parent.Announcement.Visible = false
end)

intro.Store.MouseButton1Click:Connect(function()
	script.Parent:WaitForChild("Shop").Visible = true
	intro.Visible = false
end)

script.Parent.ShopBtn.MouseButton1Click:Connect(function()
	script.Parent.Shop.Visible = not script.Parent.Shop.Visible
end)

script.Parent:WaitForChild("Shop"):WaitForChild("Close").MouseButton1Click:Connect(function()
	if game.Players.LocalPlayer:FindFirstChild("InMenu") then
		intro.Visible = true
	end
	script.Parent:WaitForChild("Shop").Visible = false
end)


