✓ Accepted answer
Your main problem is how variables behave. When you set a variable at the beginning, like you have local Strength = Fire.Size, then that variable is set once and never changes. You are using it like it is the current value of Fire.Size. This is a common early pitfall I've seen on here and the discord server.
Instead, you need to get the current value of Fire.Size and subtract 1 from that.
local Campfire = script.Parent.Parent
local Fire = script.Parent.Fire
while true do
wait(5)
Fire.Size = Fire.Size - 1
if Strength <= 0 then
Campfire:Destroy()
end
end
You have one other moderate problem and one other minor problem. First, :remove() is deprecated, don't use it, use :Destroy() instead. Second, you had if Strength == 0 then which might not always trigger if, for instance, later you set the fire's starting size to a decimal, like 5.5 because it will become 4.5 then 3.5, 2.5, 1.5, 0.5, -0.5 and it never became 0 preventing that code from running. That solution is also simple, just replace == with <=.
1 comment
Thanks!