Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i teleport random people to a part?

Asked by 5 years ago

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

0
No it does not. It does with SetPrimaryPartCFrame and such. User#19524 175 — 5y
0
uh sorry but, im lost :/ User#21093 0 — 5y
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) radusavin366 617 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

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
0
20:15:50.570 - ServerScriptService.ExhibitionGame:21: attempt to get length of global 'workspace' (a userdata value) User#21093 0 — 5y
0
nvm fixed the problem User#21093 0 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

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."

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 Axdrei 107 — 5y
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.. BunicornBoy 17 — 5y

Answer this question