this is my script, its supposed to make the enemyhumanoid walkspeed and jumppower 0 but it isnt working
Hitbox.Touched:Connect(function(Hit) if Hit:IsA("Part") or Hit:IsA("MeshPart") then if Hit.Parent ~= Character then local EHumanoid = Hit.Parent:FindFirstChild("Humanoid") local EHumRP = Hit.Parent:FindFirstChild("HumanoidRootPart") EHumanoid.WalkSpeed = 16 EHumanoid.JumpPower = 50
thank you for your time
You should see if the Humanoid exists before continuing your code. This can be done with a simple if statement.
Hitbox.Touched:Connect(function(Hit) if Hit:IsA("Part") or Hit:IsA("MeshPart") then if Hit.Parent ~= Character then local EHumanoid = Hit.Parent:FindFirstChild("Humanoid") local EHumRP = Hit.Parent:FindFirstChild("HumanoidRootPart") if EHumanoid then EHumanoid.WalkSpeed = 16 EHumanoid.JumpPower = 50 end end end end)