Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

This script should teleport every player in the server. But it kills them after they teleport. Why?

wait(5)
print("ready")
wait(1)

local TeleportPosition = Vector3.new(107.5, 9, -5)

for i, v in pairs(game.Players:GetPlayers()) do
	Humanoids = v.Character:GetChildren()
	for i, v in pairs(Humanoids) do
		if v.ClassName == "MeshPart" or v.ClassName == "Pants" or v.ClassName == "Shirt" or v.ClassName == "Part" then
			v.Position = TeleportPosition
		end
	end
end

So this teleports every player in the server to a specific location. Why does it kill them? https://youtu.be/rZSavbAGVuU Video Above For Example

1 answer

✓ Accepted answer

That's because what you actually do is iterate thru every part inside a character and put all of them in one location and also compressing them. If you move the head or a torso out of a character, it breaks the welds of the whole character, causing one to die.

What you can do instead is teleport just the HumanoidRootPart of each character so that none of the joints would break.

wait(5)
print("ready")
wait(1)

local TeleportPosition = CFrame.new(107.5, 9, -5)

for i, v in pairs(game.Players:GetPlayers()) do
    Humanoids = v.Character
    Humanoids.HumanoidRootPart.CFrame = TeleportPosition
end

6 comments

0

I thought this was the right idea, and Ive tried this. Theres still a problem. When I do this my character disappears. Im uploading a video right now.

0

woopsies got it wrong try using cframes, will edit answer

0

Thanks so much, Also if u want could you find a tutorial on youtube thats about cframes Im sorta impressed. :/

0

i don't really know if there's actual good videos in youtube about cframes, but there are a lot of good tutorials in the wiki about them. if you want a detailed one then: http://wiki.roblox.com/index.php?title=User:EgoMoose/Articles/CFramesAndVectors

0

Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.