I want to have a lobby and when a player clicks a part with a click detector in the part it teleports the player to the game. Both allow third party teleports and I followed a tutorial but it isn’t working. The click detector is under a model with a primary part if that’s important.
These are the scripts I used. They are all set to legacy.
This script is under the click detector.
local teleport = game.ReplicatedStorage:WaitForChild("Teleportplayer1")
script.Parent.MouseClick:Connect(function()
task.wait(1)
teleport:FireServer()
end)
There is a remote event under ReplicatedStorage called Teleportplayer1.
This script is under ServerScriptService.
local teleport = game.ReplicatedStorage:WaitForChild("Teleportplayer1")
local teleportservice = game:GetService("TeleportService")
local placeId = 13510305594
local players = game:GetService("Players")
local player = players:GetPlayers()[1]
teleport.OnServerEvent:Connect(function()
teleportservice:TeleportAsync(placeId,{player})
end)
The place they player is supposed to teleport to is under the lobby/starter place.
I have never tried teleporting a player to a different game before so this is my first time.