#I need a script to activate when the player touches a part, but only for them.

1 messages · Page 1 of 1 (latest)

steel pendant
#

I need a script to activate only for the player when the player touches a part.

timid gull
#

you can use the touches event on client-side

boreal moon
#

Local script

#

And touched event

grizzled field
# steel pendant I need a script to activate only for the player when the player touches a part.

If you want to be very simple make a localscript in starterCharacterScripts and put this:

local part = workspace.MyPart -- replace mypart with ur parts name

MyPart.Touched:Connect(function(hit)

if hit.Parent:FindFirstChild("Humanoid") and hit.Parent == script.Parent  then -- check if the object thats touching the part is a player and if it our player

print("TOUCHING YEAAAAH")
--put your code

end
end)

But id recommend going into raycasts and searching up how to detect if a parts being touched with a raycast because raycasts are more reliable but a bit more advanced