Problem in Teleport the player


            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?

script is Server-Side

1 Like

Dude, you can’t use MouseButton1Click on server. Use remotes instead

1 Like

are u testing on studio? if so, you can’t tp to other places on test mode

1 Like

There’s a few pages on the create.roblox site that can help you out.

1 Like

I don’t know how but it worked with me like I wrote this script and it worked and printed

	GI.Button.MouseButton1Click:Connect(function()
				print("ok")
			end)
1 Like

No I tried it from Roblox not in the Studio

1 Like

Try this without MouseButton1Click anyway maybe? (it can work without) What’s with output?

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.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.