I am having a problem where I am tryin' to make it when a player joins and put a click detector in their torso and then if it is clicked by me it will teleport that specific player.If anyone can help me that would be great :D Code:

local serivce = game:GetService("TeleportService")
game.Players.PlayerAdded:Connect(function(p)
  if p and p.Character and p.Character.Torso then
    local cd = Instance.new("ClickDetector",p.Character.Torso)
    cd.MouseClick:Connect(function(player)
      if player.Name == "AronIZOdd" then
        serivce:Teleport(5347173631,p,nil)
      end    
    end)
  end
end)

PS: it shows no error :/

6 comments

0

Are you testing this in Roblox studio if you are it cant teleport you

0

im not in roblox studio

0

Wait for the character to be added, not simply when the player joins. p.CharacterAdded

0

what problem u having tho ?

0

clickdetector cant be used inside a character. all the threads doesnt have a solution so you should probably use a block or something else (like a floating block). reply if u still need more help sorry i cant help for this matter

0

the problem is that the click detector does not even go in the torso