I am attempting to only make this affect the bottom portion of the part, but it doesn't work. It just breaks the script completely. Any help?
function onTouch(part) local humanoid = part.Parent:findFirstChild("Humanoid") if (humanoid ~=nil) then if Part.Face = Bottom then humanoid.Health = 0 end end script.Parent.Touched:connect(onTouch)
The only way ( silly roblox ) to get the face of an object, is to either print it, create an extremely complex script to detect the side, or use a PlayerMouse:
--local script player = game.Players.LocalPlayer mouse = player:GetMouse() mouse.Move:connect(function() if mouse.Target then print(mouse.TargetSurface) end end)
You cannot perform a Touched Event off of a face of a part. You could try making the part actually be 6 separate parts(For the 6 different sides). And then perform the touched events off of those. Or use Region3 or lookVector to detect where the player is when they touched the part.
Hope I Helped