So I'm making an 'if' statement code with my game script, and so I want it to do is that when a person touches a part, all the players will spawn back to the lobby. Here was my attempt before I rage quitted:
wait(30) Workspace.Tick:Play() Workspace.GUIPart.SurfaceGui.Frame.TextLabel.Text = "No one has won? What a Pity..." Workspace.Funny:Play() for i, v in pairs(game.Players:GetPlayers()) do pcall(function() v.Character.Torso.CFrame = CFrame.new(Vector3.new(63, 0, 100)) end) end wait(3) end elseif script.Parent.Parent.Parent.Character:OnTouched(Workspace.Map1.Touching)then for i, v in pairs(game.Players:GetPlayers()) do pcall(function() v.Character.Torso.CFrame = CFrame.new(Vector3.new(63, 0, 100)) end) Workspace.Tick:Play() Workspace.GUIPart.SurfaceGui.Frame.TextLabel.Text = "<[NamesNotImplementedYet]> Has Won The Round!" wait(5) end
This script is inside the 'StarterGui' folder inside a frame. By the way, Tick is the sound. When I run this script, two things happen:
1.) It does not work. 2.) The output doesn't tell me where the error is.
Please help me :(
Is that the full script? because you cannot start if statements with elseif
. If this isn't the full script, please provide it.