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

How do you change a NumberValue?

After much blood, sweat, and tears, I have decided that I must resort to this site for answers. I have been trying to add to a numbervalue located in StarterGUI by use of a local script. However, my efforts have ended with absolutely no progress. Here is my code:

while true do
	wait(1)
	script.Parent.Value = script.Parent.Value + 1
end

I'm starting to think that values can't be changed by local scripts and FE is not enabled.

1 comment

0

what type of script is this in

3 answers

✓ Accepted answer

Maybe a :WaitForChild() and you can!

local val = script.Parent:WaitForChild("Value")

while true do

wait(3)

val.Value = val.Value + 1

end

2 comments

0

If that didn't help try - while wait(3) do

0

It's not a problem with the loop. It works with a normal script in the workspace but not in StarterGui

while wait(1) do

script.Parent.ValueNameHere.Value + 1

end

Put the value inside the script and change ValueNameHere to the name of the value.

1 comment

0

If that doesn't work then try adding game.Players.PlayerAdded:connect(function(player) before while wait(1) do.

AHA!! I solved it myself. Apparently the script doesn't work in StarterGui but instead works in PlayerGui. Thanks for the help though guys!

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