Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Probably Simple NumberValue Dilemma, Help?

Asked by
lysandr 49
6 years ago
Edited 6 years ago
while script.Parent.anxiety.Value == true do
wait(1)
script.Parent.timeSpent.Value = script.Parent.timeSpent.Value + 1
end

Nothing happens when I do this. The value remains the same at 0. It runs through this loop I know it works I've used print to get it but the value does NOT change. Yes this is a normal script. Didn't run it with a LocalScript 'cause I figure that wouldn't work either since LocalScript is mostly useful for like keybinding and such. Plus laziness. It's 2:49 PM.

0
Format your code in Lua code block Goulstem 8144 — 6y
0
Where is the script located? Goulstem 8144 — 6y
0
The script is located inside of a model in Workspace, it's siblings with the numbervalue "timeSpent". lysandr 49 — 6y
0
I don't know what else you did... but I simply created a model that includes a numbervalue named timeSpent, a booleanvalue named anxiety, and a script containing your code. Everything went fine, timeSpent increased by 1 every 1 second. Draebrewop 114 — 6y
0
I figured it out. I meant to post this earlier but must've forgotten. I had other .Touched events and booleans and waits and all that jazz and then I threw this loop in there. Figured that must be the problem so I placed it in a separate script and now it's working nicely. Thanks anyway y'all! lysandr 49 — 6y

1 answer

Log in to vote
0
Answered by
iRexBot 147
6 years ago

Maybe try this script out?

while true do
    wait(1)
    if script.Parent.anxiety.Value == true then
        script.Parent.timeSpent.Value = script.Parent.timeSpent.Value + 1
    end
end
Ad

Answer this question