So... I have this script that has to run when a specific part touches the brick it's in. But I'm unsure if I have to put "hit.Name" or "hit.Parent.Name" in line 3.
Can someone help me out with this?
function onTouched(hit) game.Workspace.Coll2.CanCollide = true if hit.Parent.Name == "DoNotTouch" then workspace.Ring.BodyAngularVelocity.AngularVelocity = Vector3.new(0,0,0) workspace.DoorsMain2Open.Script.Disabled = false workspace.BarsOpen.Script.Disabled = false workspace.ClickMAIN.ClickDetector.MaxActivationDistance = 32]] script.Disabled = true end end script.Parent.Touched:connect(onTouched)
It depends on what is touching it.
If its part of a player, OR part of a bigger model, you would use
hit.Parent.Name
Otherwise, you would just use
hit.Name
Hope this helps!
It would be best and easiest to use
if hit.Parent:FindFirstChild("DoNotTouch") then