Help! I need to teleport players to a reserved server in my game, but it won't let me! Why?
Asked by
6 years ago Edited 6 years ago
I have a teleport script, it should work, but it keeps saying this when I test it out:
17:19:22.735 - TeleportService:ReserveServer can only be called by the server.
Here is the code I used:
****NOTE:**** This is a Server-Side script!
01 | local TeleportService = game:GetService( "TeleportService" ) |
03 | local ChatService = game:GetService( "Chat" ) |
04 | local i = script.Value.Value |
06 | script.Parent.Touched:connect( function (h) |
10 | local player = game.Players:GetPlayerFromCharacter(h.Parent) |
14 | local plrname = player.Name |
15 | local code = TeleportService:ReserveServer( 1248523004 ) |
16 | TeleportService:TeleportToPrivateServer( 1248523004 , code, player) |
21 | print ( "Teleport Failed (TeleportScript)" ) |
22 | ChatService:Chat(script.Parent, "Teleport of " ..plrname.. " failed. Please try in another server or if this appears again," ) |
23 | ChatService:Chat(script.Parent, "message GamingZacharyC or any scripter/programer with Masterful Studios." ) |
25 | print ( "teleporting " ..plrname.. " to the next level..." ) |
26 | ChatService:Chat(script.Parent, plrname.. " was teleported to the next level." ) |
Why is it saying this? HOW CAN I FIX IT?!