I want to make a game and I need to have a script that teleports all players, I can make the intermission and map choosing by myself, just not teleport players. I really need help with it and if you can help me I might give you admin on my upcoming game (no 100% sure if I will yet) But you will have something.
Teleport all players help?
2 answers
Teleporting Players
One of the best, and most simple way, is to move the player's Torso Position/CFrame.
For example,
local plr = workspace:WaitForChild("Player")
plr.Torso.CFrame = CFrame.new(1,1,1)-- Teleports Character
Great. It's best to wait for things to load and stuff, so to get incoming players, use a PlayerAdded Event. Like so,
-- Regular Script In Server Script Service/workspace
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
local Torso = char:WaitForChild("Torso")
Torso.CFrame = CFrame.new(1,1,1) -- Teleports Character
end)
end)
That would teleport all incoming and re-spawning players, but what if we want to teleport everyone every 20 seconds? Use a While Loop and a Pairs Loop, like so,
-- Regular Script In Server Script Service/workspace
while wait(20) do
for i,v in pairs(game.Players:GetPlayers()) do
local char = v.Character
char:FindFirstChild("Torso").CFrame = CFrame.new(1,1,1)
end
end
That would, in theory, teleport all players every 20 seconds.
Good Luck!
If you really wanna help, just make sure to click the accept button. It helps a lot.
3 comments
CFrame.new(1,1,1)<---- would the position of the map go there?
Yes. You could also Save a brick as a variable and use the CFrame of that brick to teleport the players.
Oh ok thanks. Im gonna try it out soon. heres an example of my script
local replicatedstorage = game:GetService("ReplicatedStorage") local status = replicatedstorage:WaitForChild("StatusValue")
while true do -- Intermission for i = 30,0,-1 do status.Value = "Intermission: "..i wait(1) end status.Value = "Game In Progess" while true do maps = math.random(1,3) if maps = 1 then local map = game.ServerStorage.BMap map:Clone().Parent = game.Workspace wait(15) game.Workspace.BMap:Destroy() --Where players get teleported -- Regular Script In Server Script Service/workspace while wait(20) do for i,v in pairs(game.Players:GetPlayers()) do local char = v.Character char:FindFirstChild("Torso").CFrame = CFrame.new(1,1,1) end end end if maps = 2 then local map = game.ServerStorage.AMap map:Clone().Parent = game.Workspace wait(15) game.Workspace.AMap:Destory() --Where players get teleported -- Regular Script In Server Script Service/workspace while wait(20) do for i,v in pairs(game.Players:GetPlayers()) do local char = v.Character char:FindFirstChild("Torso").CFrame = CFrame.new(1,1,1) end end end if maps = 3 then local map = game.ServerStorage.CMap map:Clone().Parent = game.Workspace wait(15) game.Workspace.CMap:Destroy() --Where players get teleported -- Regular Script In Server Script Service/workspace while wait(20) do for i,v in pairs(game.Players:GetPlayers()) do local char = v.Character char:FindFirstChild("Torso").CFrame = CFrame.new(1,1,1) end end end end wait(15) game.Workspace.BaseMap:Destroy() status.Value = "Game Over!" wait(5) end
--Would this work??
2 comments
Sorry its so sloppy by the way
gahhhh cant read that .. put it in lua syntax
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Give us a small example of code?