Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Do I Make My ClickTp button Localplayer ?

Asked by 6 years ago

How Do I do so that this script doesnt tp everyone if someone press the button

function onClicked()

local c = game.Players:GetChildren() 
for i = 1, #c do 
c[i].Character.Torso.CFrame = CFrame.new(script.Parent.Parent.Click2.Position) 
end 

end 

script.Parent.ClickDetector.MouseClick:connect(onClicked)

1 answer

Log in to vote
0
Answered by
Disti15 17
6 years ago

The MouseClick event can tell you the player who clicked:

https://wiki.roblox.com/index.php?title=API:Class/ClickDetector/MouseClick

function onClicked(player)
    player.Character.Torso.CFrame = CFrame.new(script.Parent.Parent.Click2.Position)
end 

script.Parent.ClickDetector.MouseClick:connect(onClicked)
Ad

Answer this question