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

How to update data value to variable in script?

Asked by 6 years ago
Edited 6 years ago

This is not working. I need it in a function but when I change the string value in game.workspace this won't change

function example()
    data = game.Workspace.Numb
    while data.Value == 0 do
        print("same value")
    wait(1)
    end
    print("value = 1")
end
example()

Please help

0
Drop the `.Value` from `data`, set it with `data.Value = ...`, and don't mark posts as "Urgent" in the future. fredfishy 833 — 6y
0
sorry I don't get it superbolt999 36 — 6y
0
Line 2 should be `data = game.Workspace.Numb`, and like 3 should be `while data.Value == 0 do`. fredfishy 833 — 6y
0
If you do `data = game.Workspace.Numb.Value`, data is set to literally the value of Numb, rather than being a reference to the field. To do what you're doing, you need it to be a reference to the field, rather than an absolute value. fredfishy 833 — 6y
View all comments (7 more)
0
I changed it but it still did not work superbolt999 36 — 6y
0
it's because data is not = to 0 INOOBE_YT 387 — 6y
0
so the while loop stops, and "same value" does not print INOOBE_YT 387 — 6y
0
You don't need a reference to the property. Just directly access the property. User#24403 69 — 6y
0
same value prints but value = 1 does not print superbolt999 36 — 6y
0
incapaxian can you type the full code for me please thanks superbolt999 36 — 6y
0
Directly accessing the property is still a reference to the property. fredfishy 833 — 6y

Answer this question