It shows this error from this script
-- Script
local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
Players.PlayerAdded:Connect(function(LocalPlayer)
local IsPrivateServer = Instance.new("BoolValue", LocalPlayer)
IsPrivateServer.Value = false
IsPrivateServer.Name = "IsPrivateServer"
if LocalPlayer.UserId == game.PrivateServerOwnerId then
warn("PRIVATE SERVER")
IsPrivateServer.Value = true
else
warn("PUBLIC SERVER")
end
end)
local function TP(ID, ReserveServerID, Player)
TeleportService:TeleportToPrivateServer(tonumber(ID), ReserveServerID, Player) -- error here
end
game:GetService("ReplicatedStorage"):WaitForChild("TpPlayerPrivateServer").OnServerEvent:Connect(function(LocalPlayer, ID, UserID)
warn(LocalPlayer, ID, UserID)
local Player = Players:GetPlayerByUserId(tonumber(UserID))
print(Player)
local ReserveServerID = TeleportService:ReserveServer(tonumber(ID))
TP(ID, ReserveServerID, Player)
end)
-- Local script
local LocalPlayer = game.Players.LocalPlayer
local TeleportService = game:GetService("TeleportService")
local ID = 15691218136
script.Parent.MouseButton1Up:Connect(function()
if LocalPlayer:WaitForChild("IsPrivateServer").Value == true then
game:GetService("ReplicatedStorage"):WaitForChild("TpPlayerPrivateServer"):FireServer(ID, LocalPlayer.UserId)
else
TeleportService:Teleport(15691218136, LocalPlayer)
end
end)
I dont know what is wrong.
Basically I am doing a teleport gui to teleport players to other places in my game. I am making a script that detect if a player is in a private server in my game to when the player the player choose a place to teleport it don’t go to a public server of the place.
Public main place = Public Server
Private main place = private server
please help