I want to make it so if someone clicks a part they get teleported to a game but my script is not working and I would appreciate some help.
script.Parent.ClickDetector.MouseClick:connect(function() wait(2) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then game:GetService("TeleportService"):Teleport(165643174, player) end end)
Some events get the information you need like with mouse click, it will tell you what player clicked the brick.
script.Parent.ClickDetector.MouseClick:connect(function(player) --You want to have the script identify the player here. wait(2) -- Just completely remove this line, it was set up for a Touched event. if player then --Good, keeping the script from breaking. game:GetService("TeleportService"):Teleport(165643174, player) end end)
I haven't tested this, nor have I really test Teleport Service, but I think this will work.