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

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!

01local TeleportService = game:GetService("TeleportService")
02local id = 1248523004
03local ChatService = game:GetService("Chat")
04local i = script.Value.Value
05 
06script.Parent.Touched:connect(function(h)
07    if i == true then
08        return
09    end
10    local player = game.Players:GetPlayerFromCharacter(h.Parent)
11    if not player then
12        return
13    end
14    local plrname = player.Name
15    local code = TeleportService:ReserveServer(1248523004) -- the error is directed towards here.
View all 28 lines...

Why is it saying this? HOW CAN I FIX IT?!

0
Either you're testing in studio or you used a client-sided script in a server is why this happens spr_ead 47 — 6y
0
im testing in studio. i'll try in Play Mode. GamingZacharyC 152 — 6y
0
it doesn't work in the server either. GamingZacharyC 152 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

This is because it is not a game server. It is a private server it does not show up on the server list so the game cannot find it.

Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

I tried in the servers, but it still flopped.

Answer this question