Why does it not teleport all the players?

local players = Players:GetPlayers()

for i, v in pairs(players) do
	if v:FindFirstChild("Values") then
		if v.Values.InSubway.Value == true then
			local clone = FlashLight:Clone()
			clone.Parent = v.Backpack
			v.Character.Humanoid.Jump = true
			v.Character.Humanoid.WalkSpeed = 12
			v.Character.Humanoid.JumpPower = 0
			task.wait(0.1)
			BE.UnWeldSeats:Fire()
			task.wait(0.05)
			v.Character:PivotTo(TPPart.CFrame)
		else
			
		end	
	end
end

This script is meant to teleport all the players that have the InSubway value set to true. But when my friend and I test it, and the InSubway value is set to true, it only teleports me, instead of both.

Why is that?

Any help is appreciated!

What is that else statement for? If it’s useless just remove it

1 Like

Would that solve the problem, or just simplify my script?

I donno, you can try that though

Your code is correct it might be your freind’s InSubway value that is not true

Try debugging with print statements to see where the script stacks. Also, if you set the players variable before any player has joined the server, it will not get all the players when iterating through it.

The else is what made it not work??

I got rid of it and now it works. Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.