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

bruh back with another question!!!! why won't this script teleport teh players to a private server?

Asked by 4 years ago
Edited 4 years ago

local TS = game:GetService("TeleportService")

local Players = game:GetService("Players")

local placeID = 5002451166

local code = TS:ReserveServer(game.placeID) -- Returns a code

local players = Players:GetPlayers() -- Get a list of all players

TS:TeleportToPrivateServer(game.placeID,code,players) -- Actually teleport the players

-------I am testing this in a real game, not in roblox studio by the way.----

So this script is meant to run when a player joins the "lobby" Place in my Game. It should wait 10 seconds, then teleport the players in that lobby server to the map. (the map is a seperate Place in my Game, btw)

0
What is "game.5002451166" for? itz_rennox 412 — 4y
0
its the id of the game that i want the players to be teleported to. KingIce1310 23 — 4y
0
try to replace it with "5002451166" itz_rennox 412 — 4y
0
aight thx KingIce1310 23 — 4y
View all comments (13 more)
0
yeah that didnt work KingIce1310 23 — 4y
0
u said u are testing ingame, press f9 (output key) what is in it? itz_rennox 412 — 4y
0
btw game.placeId wont teleport you itz_rennox 412 — 4y
0
it said no messages were found KingIce1310 23 — 4y
0
what will teleport me to that place's id? KingIce1310 23 — 4y
0
just replace "game.placeID" with "placeID" itz_rennox 412 — 4y
0
aight KingIce1310 23 — 4y
0
look: In the "placeID" variable you put the placeId where u want to teleport, then u write "TS:ReserveServer(placeID)" and TS:TeleportToPrivateServer(placeID,code,players) itz_rennox 412 — 4y
0
ohh dang I understand something wrong sryyyyy itz_rennox 412 — 4y
0
Let me write an answer xD itz_rennox 412 — 4y
0
okie KingIce1310 23 — 4y
0
u done? thx :) KingIce1310 23 — 4y
0
u done? thx :) KingIce1310 23 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")

local code = TS:ReserveServer(game.PlaceId)
local players = Players:GetPlayers()

TS:TeleportToPrivateServer(game.PlaceId,code,players)

I compared it with your code and your code should be right cuz it works for me .-. Maybe its just because you wrote "PlaceID" instead of "PlaceId" ?

Edit (cuz u wanted it):

local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")

local tid = YOURPLACEID 

local code = TS:ReserveServer(tid)
local players = Players:GetPlayers()

TS:TeleportToPrivateServer(tid,code,players)

Second edit:

game.Players.PlayerAdded:connect(function(plr)
wait(10) --Cuz you wanted a wait time
local TS = game:GetService("TeleportService")

local tid = YOURPLACEID 

local code = TS:ReserveServer(tid)

TS:TeleportToPrivateServer(tid,code,plr)
end)

Third edit:

Ok for everyone who wants to know what the issue was:

He used a LocalScript in the server xD
Just replace the localscript with a normal script :D
I hope this can help some people
You guys just can read all comments under all answers here .-.
0
ok but how do i define the id of the place i want to be teleported to? cuz on ur script theres no place to define it KingIce1310 23 — 4y
0
wait let me edit something :D itz_rennox 412 — 4y
0
yeah its still not working KingIce1310 23 — 4y
0
thats strange itz_rennox 412 — 4y
View all comments (9 more)
0
i added a wait(5) before the TS:TeleportToPrivateServer(tid,code,players) KingIce1310 23 — 4y
0
but its still not workingggggg KingIce1310 23 — 4y
0
Wait when does ur script run? itz_rennox 412 — 4y
0
? KingIce1310 23 — 4y
0
Cuz maybe u just dont get teleported cuz u are not in the game .- itz_rennox 412 — 4y
0
maybe u can just add a longer wait time? itz_rennox 412 — 4y
0
but i already added a wait(5) function? maybe i should add a playeradded function as well. where should i put it ? KingIce1310 23 — 4y
0
at the start itz_rennox 412 — 4y
0
aight KingIce1310 23 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

is this where i should put the playeradded func?

local players = Players:GetPlayers()

Players.PlayerAdded:Connect(function(player)

local TS = game:GetService("TeleportService")

local Players = game:GetService("Players")

local tid = 5002451166

local code = TS:ReserveServer(tid)

wait(10) TS:TeleportToPrivateServer(tid,code,players)

0
wait let me edit the script again itz_rennox 412 — 4y
0
ok KingIce1310 23 — 4y
0
na still not working :C KingIce1310 23 — 4y
0
wth itz_rennox 412 — 4y
View all comments (21 more)
0
Thats verrrrrryy strangggge itz_rennox 412 — 4y
0
ikr KingIce1310 23 — 4y
0
Ok first of all: Is your script a server script? + is it enabled? + where did you put it? itz_rennox 412 — 4y
0
its a localscript in serverscriptservice and its not disabled KingIce1310 23 — 4y
0
LocalScripts wont work in the server... itz_rennox 412 — 4y
0
Use a normal script :D itz_rennox 412 — 4y
0
ight changed it to a normal script - is it in the right place tho? KingIce1310 23 — 4y
0
yes itz_rennox 412 — 4y
0
okie its still not working thooooooooooooo KingIce1310 23 — 4y
0
And remember that LocalScripts will only work in : StarterPack,StarterPlayerScripts,StarterGui itz_rennox 412 — 4y
0
wait it must work now itz_rennox 412 — 4y
0
wait it must work now itz_rennox 412 — 4y
0
You said u are testing ingame: Did u leave the game and published the update? itz_rennox 412 — 4y
0
ok but do you have any other solutions? I tried putting the script in workspace instead of serverscriptservice but that didnt work KingIce1310 23 — 4y
0
yeah i left the game and pubished the update KingIce1310 23 — 4y
0
Scripts can work in serverscriptservice itz_rennox 412 — 4y
0
are you sure that there are 100000001% no errors? itz_rennox 412 — 4y
0
yes i am 1000000000000000000000000000000000000000000000001 percent sure m8 KingIce1310 23 — 4y
0
hmmmmm itz_rennox 412 — 4y
0
Strange.. its working fine for me, I guess I cant help u itz_rennox 412 — 4y
0
ok rip KingIce1310 23 — 4y

Answer this question