Why does this script 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
			print(v.Name)
			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)
			print(v.Name)
		end	
	end
end

Whenever my friend and I test our game, it only teleports 1 player, ALTHOUGH, the InSubway value is set to true for BOTH of us, the prints print BOTH our names twice, but it doesn’t seem to teleport both of us, just one.

This only happens when BOTH of us are sitting in a seat, we both get teleported if only 1 of us, or none of us sit in a seat.

Why is this happening.

Any help is appreciated!

try to set the humanoidrootpart cframe to the tp cframe, and check if they’re sitting to get them up

Your code looks perfect. Also, I think Tin doesn’t know about PrimaryPart. Well anyway try moving the head and see if your friend becomes headless.

1 Like

How would I do this? With a script, or just in the server while testing?

I guess make it so it teleports your head instead. Also, try adding a Noob startercharacter and see if your friend moves (using PivotTo). Also try adding a 0 second wait, that might magically fix it.

1 Like

Instead of PivotTo(), I did v.Character.Head.CFrame = TPPart.CFrame, and his whole body got teleported (didnt behead him), but I didn’t.

Strange. Maybe setting HumanoidRootPart CFrame would work, based on this fact. All of this seems to depend on the avatar strangely enough. If that doesn’t work try using the original code but add a 0 second wait before teleporting.

1 Like

Sorry, I just figured it out.
The Humanoid.Jump = true wasn’t working because Humanoid.JumpPower was equal to 0, (even though it came after the script.)

But it works now. Thank you for your help!

1 Like

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