parts = script.Parent; --Parts Model For The Ship dealingdamage = (math.random(0,100))
function onTouched(hit)
if (hit.Parent.Name == "Hull") or (hit.Parent.Name == "Turret") or (hit.Parent.Name == "Gun") or (hit.Parent.Name == "Parts") then
print("You Have Damaged a Vehicle")
hit.Parent:findFirstChild("Pen"):Play()
hit.Parent.Parent:findFirstChild("Damage").Value = hit.Parent.Parent:findFirstChild("Damage").Value - dealingdamage
if hit.Parent.Parent:findFirstChild("Damage").Value<1 then
print("Vehicle Disabled")
local hiten = hit.Parent.Parent.Parts.Engine
end
end
this script goes into say a bullet and fires at a object with a value named damage and the bullet does random damage it works fine for the ships i have it for but iv been trying to have an AI to do the same and no luck help?
