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

11 comments

0

Drop the .Value from data, set it with data.Value = ..., and don't mark posts as "Urgent" in the future.

0

sorry I don't get it

0

Line 2 should be data = game.Workspace.Numb, and like 3 should be while data.Value == 0 do.

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.

0

I changed it but it still did not work

0

it's because data is not = to 0

0

so the while loop stops, and "same value" does not print

0

You don't need a reference to the property. Just directly access the property.

0

same value prints but value = 1 does not print

0

incapaxian can you type the full code for me please thanks

0

Directly accessing the property is still a reference to the property.