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

Why does this not change the text?

Asked by 6 years ago
StageNo = game.ServerStorage.StageNo.Value

while true do 
    script.Parent.Text = StageNo
    wait(0.01)
end

so im trying to make it so that the text changes to 1 when i hit something i printed out the value when i hit it and it come out with one(which is good) however, it doesnt afect the text value. Why? How do i fix it?

1 answer

Log in to vote
0
Answered by
ee0w 458 Moderation Voter
6 years ago

This is quite a common mistake, slightly hard to explain but quite simple: target the Value object, not the .Value itself.

What I mean by this is instead of using Value.Value, you use Value and change the .Value property.

StageNo = game.ServerStorage.StageNo

while true do
   script.Parent.Text = StageNo.Value
   wait()
end

To put this into simplicity, when setting a variable to a property, it only sets itself to the property and doesn't affect it. In order to change the property you need to target the object itself, then add your property you want to change. Kinda hard to wrap your head around first but once you understand it it's easy.

0
I'll accept the answer, but i already fixed it with a global variable i.e. _G.StageNo RealRexTerm 21 — 6y
Ad

Answer this question