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

how do i teleport random people to a part?

i been trying to find out how to teleport random people to a part but can't figure out how it works. ik it has something to do with (MoveTo) or something like that but im not for sure

3 comments

0

No it does not. It does with SetPrimaryPartCFrame and such.

0

uh sorry but, im lost :/

0

pick a random player from the players directory (instead of the workspace), then set their humanoidrootpart's cframe to the part's cframe (Player.Character.HumanoidRootPart)

2 answers

✓ Accepted answer

Put this in server script service

local plrs = workspace:GetChildren()
local part = workspace:WaitForChild("part")

workspace.ChildrenAdded:connect(function(instance) -- gets a new player if he joins
	plrs = workspace:GetChildren()
end)

wait(60) --teleports after 60 seconds

for i = 1, #workspace do
	if plrs[i]:FindFirstChild("Humanoid") then --finds the humanoid
		local torso = plrs[i]:FindFirstChild("HumanoidRootPart") --finds the torso
		torso.CFrame = part.CFrame --teleports
	end
end

2 comments

0

20:15:50.570 - ServerScriptService.ExhibitionGame:21: attempt to get length of global 'workspace' (a userdata value)

0

nvm fixed the problem

I can't make a script right now as I'm on holiday (no computer) but I can tell you how. You would need to pick a random from Workspace, make sure it has humanoid. If humanoid is true, teleportFunction(player). Before this, define the players character as player variable.You need to create a new function that will teleport the Torso (or upper/lower torso depending on r15) to the part. Using CFrame, define the part with local (local part = script.Parent.......) and p1.UpperTorso.CFrame = part.CFrame."

2 comments

0

no this is wrong, "pick a random from workspace, make sure it has humanoid" what if there was a bot? this is completly useless & wrong

0

Technically it's not wrong as it could work and please don't rude as this is a kindness community. I was just trying to help..

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