Here is my code:
01 | wait( 30 ) |
02 | Workspace.Tick:Play() |
03 | Workspace.GUIPart.SurfaceGui.Frame.TextLabel.Text = "No one has won? What a Pity..." |
04 | Workspace.Funny:Play() |
05 | for i, v in pairs (game.Players:GetPlayers()) do |
06 | pcall ( function () v.Character.Torso.CFrame = CFrame.new(Vector 3. new( 63 , 0 , 100 )) end ) |
07 | end |
08 | wait( 10 ) |
09 | end |
10 |
11 | elseif script.Parent.Parent.Parent.Character:OnTouched(Workspace.Map 1. Touching) then |
12 | for i, v in pairs (game.Players:GetPlayers()) do |
13 | pcall ( function () v.Character.Torso.CFrame = CFrame.new(Vector 3. new( 63 , 0 , 100 )) end ) |
14 | Workspace.Tick:Play() |
15 | Workspace.GUIPart.SurfaceGui.Frame.TextLabel.Text = "<[NamesNotImplementedYet]> Has Won The Round!" |
16 | wait( 5 ) |
17 | end |
'Tick' and 'Funny' are soundtracks in the game. On the elseif statement, when the players touch a part they spawn back to the lobby and they win. But for some reason mine doesn't work. Anyone help me?
I only fixed the main problem, just add this part to your script instead of the elseif .
1 | function script.Parent.Parent.Parent.Character.Touched:connect( function () --you need to call a function here not a if or elseif |
2 | for i, v in pairs (game.Players:GetPlayers()) do |
3 | pcall ( function () v.Character.Torso.CFrame = CFrame.new(Vector 3. new( 63 , 0 , 100 )) end ) |
4 | Workspace.Tick:Play() |
5 | Workspace.GUIPart.SurfaceGui.Frame.TextLabel.Text = "<[NamesNotImplementedYet]> Has Won The Round!" |
6 | wait( 5 ) |
7 | end ) |
also please only put the part of the script that has a problem not the whole script.