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)

1 comment
Thankyou for the help. It works