local TeleportService = game:GetService("TeleportService") local Place = 4506512824 local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() TeleportService:Teleport(Place, player) end)
That's my script. It's supposed to teleport the player to the dungeon alone as a "quickstart" feature. It doesnt do anything on click, and there are no errors. Is there anything I'm doing wrong?
You used Teleport, not TeleportToPrivateServer. First, you need to reserve a server. You can do this by using the code:
local RSID = game:GetService("TeleportService"):ReserveServer(game.PlaceId)
NOTE: You cannot create reserved servers in Roblox Studio. You must be in a live game.
Visit the Roblox Developer Wiki for more info on ReserveServer
This will create a new ReservedServer. The RSID variable will be the ReservedServer ID.
To teleport people to a ReservedServer, use:
game:GetService("TeleportService"):TeleportToPrivateServer(game.PlaceID,RSID,{player})
Visit the Roblox Developer Wiki for more info on TeleportToPrivateServer
Argument 1: Game Place ID Argument 2: Reserved Server ID Argument 3: Table of players that you want to teleport
Hope this helps!
(The fixed version of your code:
local TeleportService = game:GetService("TeleportService") local Place = 4506512824 local RSID = TeleportService:ReserveServer(Place) script.Parent.MouseButton1Click:connect(function() game:GetService("TeleportService"):TeleportToPrivateServer(Place,RSID,{player}) end)
Multiplayer version:
local TeleportService = game:GetService("TeleportService") local Place = 4506512824 local RSID = TeleportService:ReserveServer(Place) script.Parent.MouseButton1Click:connect(function() local players = {} local children = game.Players:GetChildren() for i = 1, #children do if children[i].ValueLocation.Value == true then table.insert(players,children[i]) end end game:GetService("TeleportService"):TeleportToPrivateServer(Place,RSID,players) end)
)
You first have to reserve the server, doing
:ReserveServer(placeId)
and then you have to teleport them to the reserved server, doing
TeleportToPrivateServer(placeId, reserveServer Code, player)
You CANNOT teleport in ROBLOX Studio, only in Live ROBLOX Servers.
local TS = game:GetService("TeleportService") local placeId = 4506512824 local serverCode = TS:ReserveServer(placeId) local players = {player} TS:TeleportToPrivateServer(placeId,serverCode,players)
You first have to set the code you received from the reserve server function, and use that to teleport the player.
Then you have to create a table, as that's the argument that is passed through teleport to private server.
Then you use the teleport to private server function, and the first argument is the place id you want them to teleport to, the second one is the server code you received from reserve server function, and then the table of players that you want to teleport.
I'm not sure on how you have your GUI's and stuff setup, but this is how it's supposed to be used.
You can adjust this to fit your needs.
Hope this helped! Didn't have much time to go into detail, but if this helped you, don't forget to select this as the answer!