Currently, I'm in the process of designing a NPC that I'm going to use for one of my games. However, this script isn't working the way I'd like it to. How ideas on how I could fix it? The whole point of the script is to make my NPC jump when it touches a part but not when it touches the part of a Player.
function onTouched(part) if part.Name ~= {"Torso","Left Arm","Right Arm","Left Leg","Right Leg","Head"} then script.Parent.Parent.Zombie.Jump = false if else script.Parent.Parent.Zombie.Jump = true end end end script.Parent.Touched:connect(onTouched)
Try this;
local zombo = script.Parent.Parent:WaitForChild("Zombie") --Change this to the NPC zombo.Touched:Connect(function(Hit) if Hit.Parent.Name ~= {"Torso","Left Arm","Right Arm","Left Leg","Right Leg","Head"} then zombo.Jump = false else zombo.Jump = true end end)
This should work, if it helped please accept answer.