local function GetPlayers(TheFile)
for _, i in pairs(TheFile) do
table.insert(players_tabel, i)
end
end
GI.Button.MouseButton1Click:Connect(function()
GetPlayers(Players:GetChildren())
local tpsevice = game:GetService("TeleportService")
local reserve = tpsevice:ReserveServer(placeID)
tpsevice:TeleportToPrivateServer(placeID, reserve, players_tabel)
end)
Why doesn’t it Teleport the players is there a problem with the script?
Hey, in the button you should have a local script to detect when the button is pressed. When it is pressed it should fire a remote event to the server. In the Server side script you should then have that detect when the button has been pressed and event been fired then have your function to teleport after. Here is an example.
Button Local Script:
local RemoteEvent = game.ReplicatedService.RemoteEvent
local Button = script.Parent
Button.MouseButton1Click:Connect(function()
RemoteEvent:FireServer()
end)
Server Side Script:
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
RemoteEvent.OnServerEvent:Connect(Function()
print("This is where you should put your teleport code.")
end)
Note: I wrote this on a phone so some of the code may not work however the majority of it should work.