How do I make A Player Touched work properly?

so I currently use

script.parent.Touched:Connect(function(hit)
if script.parent.Touched then
print(“Works”)

But when a player spawns in game it automatically calls the hit before the player touched anything so I have no clue what I am doing sadly! The script is inside a part but I assumed the touched function meant if A touched B then it would output your script, not when a player spawns in. What am I doing wrong in this situation?

script.parent.Touched:Connect(function(hit)
   print("Works")
end)
``
1 Like
local Part = path.to.part

Part.Touched:Connect(function(Hit)
print("This works!")
-- do other stuff here
end)
1 Like

So is my mistake the “If script.parent.Touched then” ?

Your part may be unanchored.

This text will be blurred

1 Like