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

How do I teleport all players within an area or a part?

Asked by 1 year ago

I want to, inside of a proximity.Triggered function, teleport all players that is inside of a part to another part. Could someone help me write that script or tell me how to do it?

0
Are you asking for help on the script or do you just want me to write the script for you? nathanjohns123 20 — 1y
0
I asked the question because I have no clue on where to begin. I have not done something like it before and therefore don't know how to write the script. Any help is appreciated! VelocityVH 6 — 1y
0
This should be a smaller script I think because you would only change the CFrame of the players humanoidrootpart right? But I don't know how to get the players humanoidrootparts that are inside of this area or part. VelocityVH 6 — 1y

2 answers

Log in to vote
0
Answered by
Puppynniko 1059 Moderation Voter
1 year ago
Edited 1 year ago
game.ReplicatedStorage.TeleportEvent.OnServerEvent:Connect(function(plr,owner)

    for _, plr in pairs(game.Players:GetChildren()) do

        --add your position and offsets here
                 local ZOffset = math.random(-5,5)
                 local XOffset = math.random(-5,5)
        plr.Character.HumanoidRootPart.CFrame = CFrame.new(owner.Character.HumanoidRootPart.Position.X + XOffset, owner.Character.HumanoidRootPart.Position.Y,owner.Character.HumanoidRootPart.Position.Z + ZOffset  ) --Position can be changed here

    end

end)
0
this would teleport all players right? VelocityVH 6 — 1y
0
But what I wanted is to teleport just the players that are inside of a specific part VelocityVH 6 — 1y
0
use a region3 or Magnitude range check Puppynniko 1059 — 1y
Ad
Log in to vote
0
Answered by
enes223 327 Moderation Voter
1 year ago

hey you! have you ever heard of enes? if you are in trouble, better call enes!

Answer this question