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

I need help teleporting all players to a spawnpoint. Help?

Asked by 2 years ago

I am making a round based game and need help teleporting the players to some parts (so they are spread out) but I don't know how to script this and need help.

0
Is it multiple parts or just one? coolkid222131 19 — 2y
0
it is multiple parts akbanana7 37 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

Sorry I don't know how to teleport people to multiple parts. But this may help.

Make a gui and add a text button. Put a local script within that text button and use the following script,

script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.TeleEvent:FireServer() --Make an event in replicated storage and name it "TeleEvent". 
end)

After that make a script in server script service and say this.

game.ReplicatedStorage.TeleEvent.OnServerEvent:Connect(function()

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

        local part = game.Workspace.Telepart --Make a part that is named that.
                local pos = part.CFrame

        plr.Character.HumanoidRootPart.CFrame = CFrame.new(pos) 

    end

end)

This script will teleport everyone in the server to that part.

0
i will try to use the same remote event in my main script for the game. Thanks! akbanana7 37 — 2y
Ad

Answer this question