i tried to made math ui that teleport when there are 2 players and i am see problem in line 2 about the character
here is the code:
local player = game.Players.LocalPlayer
local character = player.Character
script.Parent.Main.JoinMath.MouseButton1Click:Connect(function(AddPlayer)
game.Workspace.Values.Players.Value = game.Workspace.Values.Players.Value + 1
end)
while wait() do
if game.Workspace.Values.Players.Value == 0 then
script.Parent.Main.PlayerAmount.Text = "2 Players Needed."
game.Workspace.Values.Math.Value = false
end
if game.Workspace.Values.Players.Value == 1 then
script.Parent.Main.PlayerAmount.Text = "1 Players Needed."
game.Workspace.Values.Math.Value = false
end
if game.Workspace.Values.Players.Value == 2 or game.Workspace.Values.Players.Value >= 2 then
script.Parent.Main.PlayerAmount.Text = "Starting Math Soon."
wait(15)
game.Workspace.Values.Math.Value = true
if character:FindFirstChild("Humanoid") then
character.Head.CFrame = CFrame.new(game.Workspace.Math.Position)
end
end
--[[game.Workspace.Values.Math.Changed:Connect(function()
if game.Workspace.Values.Math.Value == false then
script.Parent.Main.Visible = true
end
if game.Workspace.Values.Math.Value == true then
script.Parent.Main.Visible = false
end
end)]]--
end