So I made a script whenever this block hits 0 or less hp it will drop a block worth money although the script will not run at all, the block is taking damage and getting to the negatives. I have some of the code based off a tycoon kit just to help me get started out and learn the process, but I'm unsure what is wrong with this.
workspace:WaitForChild("PartStorage")
while true do
if parent.Humanoid.Health <= 0 then
local part = Instance.new("Part",workspace.PartStorage)
part.BrickColor = BrickColor.new("Rust")
part.Material = Enum.Material.Slate
part.Anchored = false
local cash = Instance.new("IntValue",part)
cash.Name = "Cash"
cash.Value = 5
part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1,0)
part.Size=Vector3.new(3,3,3)
script.Parent.Parent:remove()
end
