Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Damage script not dealing damage at a constant rate?

I am trying to create an NPC that damages itself, 10 damage per second. I wrote this script in order to complete said task:

local ConchHealth = script.Parent.Health

while wait(1) do
	ConchHealth = ConchHealth - 10
end

This script is placed inside of the Humanoid.

Things I've Tried:

Placing it elsewhere in the NPC.

Testing to see if it was the while loop (It wasn't).

Any help is appreciated.

1 answer

✓ Accepted answer

This... won't work.

Fixed:

while wait(1) do
script.Parent.Health = script.Parent.Health - 10
end

2 comments

0

Thanks!

0

Potato, please view updated script; made a typo and used = instead of - ;-;

This discussion is preserved as it was. New answers, comments, and votes are closed.