Ok so here is the local script
Player = game.Players.LocalPlayer Mouse = Player:GetMouse() Ammo = 1 Mouse.KeyDown:connect(function(key) key = key:lower() if key == "f" and Ammo >0 then local x = Instance.new("Part", workspace) x.Size = Vector3.new(20,0,0) x.Shape = "Ball" x.BrickColor = BrickColor.new ("Toothpaste") x.Material = "Neon" x.Transparency = 0.2 x.TopSurface = "Smooth" x.BottomSurface = "Smooth" x.CanCollide = false x.CFrame = Player.Character.Torso.CFrame * CFrame.new(0,-1,-5) local v = Instance.new("BodyVelocity", x) v.velocity = Player.Character.Torso.CFrame.lookVector * 90 v.maxForce = Vector3.new(math.huge, math.huge, math.huge) Ammo = Ammo -1 wait(1) Ammo = 1 local S = script["Script"]:clone() S.Parent = x x.Parent = workspace wait(2) x:remove() end end)
But i made it so it can attack but gets that error heres the script that won't work.
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Zombie")~=nil then hit.Parent.Zombie.Health = hit.Parent.Zombie.Health - 4 script.Parent.remove() end end)
could someone tell me whats wrong and put the script down there thanks :D
Explanation
It means exactly what it says. Health is not a valid member of Zombie
. In other words, a model has no property Health.
I know what you're trying to do though (yeah spooky i know)
Health is a property of Humanoid
, not the model 'Zombie'
Solution
So you'd want to do:
hit.Parent.Zombie.Humanoid.Health = hit.Parent.Zombie.Humanoid.Health - 4
instead of
hit.Parent.Zombie.Health = hit.Parent.Zombie.Health - 4