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

How to prevent my teleport script teleporting to the place i just were?

Asked by 7 years ago

Okay so I have a serverscript in ServerScriptService and when a specific players says :update it teleports everyone to a server so the game can update but my script is teleporting to the place i just were instead it should teleport to the placeid Here is my script

01names = {'Timmerman73','mastergozo123','thorcelli','trolltracker393YT'}
02 
03game.Players.PlayerAdded:connect(function(player)
04    for i, v in pairs(names) do
05        if v == player.Name then
06            player.Chatted:connect(function(chatmsg)
07                if chatmsg:sub(1,7) == ':update' then
08                    local msg = Instance.new('Message',workspace)
09                    msg.Text = 'S-S-F is getting an Update Teleporting'
10                    wait(1)
11                for _, player in pairs(game.Players:GetPlayers()) do
12                    local tpservice = game:GetService('TeleportService')
13                    local placeid = 1501752084
14                tpservice:Teleport(placeid,player)         
15end
16end
17end)
18end
19end
20end)

Help would be appreciated.

Answer this question