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

For some reason, changing this value doesn't work?

I'm trying to edit a NumberValue with a localscript inside (I'm making a tool) but it doesn't change it. What it is suposed to do is lower a numval named CD(The parent) to 0 but it stays at 10.

local cooldown = script.Parent
while true do
	wait(1)
	if cooldown.Value >= 1 then
		cooldown.Value = cooldown.Value - 1 --I have tested this with print, and that works.
	end
end

I'm probably doing a dumb mistake since i'm tired.

2 comments

0

What's your hierarchy

0

LocalScripts only run on the server

1 answer

Try the following on a regular script!

local cooldown = script.Parent --Make sure this path is correct.
while wait(1) do --Simplified your code by putting wait(1) on the loop.
	if cooldown.Value > 0 then --Here I don't really trust <= nor >= because that already failed with me sometimes, so I'll just put > and take one value, changing from >= 1 to > 0.
		cooldown.Value = cooldown.Value - 1 --Nothing to point here, as this should be working.
	end
end

If this works, please mark as the correct answer! <3

As always, good scripting!

1 comment

0

Thought to always use local scripts in tools, lol

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