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

how to teleport selected children?

Asked by 6 years ago

continue the script: Game.Players.mathrandom.GetChildren
let the children have been selected but it is necessary that this selected children be teleported to the coordinates -687.5, 34.7, 520.5

0
So you're wanting a random user to be teleported to the coordinates? M39a9am3R 3210 — 6y
0
yes anton5808 -6 — 6y

2 answers

Log in to vote
0
Answered by
mattscy 3725 Moderation Voter Community Moderator
6 years ago

This will choose a random player and teleport them to the location

local plrs = game.Players:GetPlayers()
local chosenPlr = plrs[math.random(1,#plrs)] --set chosenPlr to a random player
if chosenPlr.Character and chosenPlr.Character:FindFirstChild("HumanoidRootPart") then
   chosenPlr.Character.HumanoidRootPart.CFrame = CFrame.new(-687.5, 34.7, 520.5)
end
0
He wants to select players FazNook 61 — 6y
0
GOOD!!! WORKED!!! THANKS YOU!!! anton5808 -6 — 6y
Ad
Log in to vote
0
Answered by
FazNook 61
6 years ago

Assuming that plrs are the selected Players

Local location = yourcoordshere
for i,v in pairs(plrs) do
pcall(function()
v.Character.Torso.CFrame = CFrame.new(location)
end)
end

Please let me know if this works. Make sure to upvote if it does. This script might be subject to errors

0
if I'm writing Game.Players.mathrandom.GetChildren Local location = yourcoordshere for i, v in pairs (plrs) do pcall (function () v.Character.Torso.CFrame = CFrame.new (location) end) end then the word "Local" is highlighted in red and if I write Local location = yourcoordshere for i, v in pairs (plrs) do pcall (function () v.Character.Torso.CFrame = CFrame.new (location) end) end then the word anton5808 -6 — 6y
0
coordinats i too write anton5808 -6 — 6y

Answer this question