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

{FIXED} Why is my script not updating my GUI's text instantly?

Asked by 10 years ago

My script is meant to keep updating constantly, but when people earn player points it will not decrease on the GUI until you reset your character. Please could someone modify this to make it constantly update so players do not have to reset to see the current amount of player points!

points = Game:GetService("PointsService")
awardable = points:GetAwardablePoints()

while true do
    wait()
    if awardable == 0 then
    wait()
    script.Parent.Text = "This game is currently out of available player points"
    else
    wait()
    script.Parent.Text = "Player Points Available: "..awardable..""
    end
end

1 answer

Log in to vote
1
Answered by
2eggnog 981 Moderation Voter
10 years ago

That's happening because you set awardable to the awardable points before you started the loop. Since it wasn't inside the loop, it wouldn't update.

points = Game:GetService("PointsService")

while true do
    local awardable = points:GetAwardablePoints()
    if awardable == 0 then
        script.Parent.Text = "This game is currently out of available player points"
    else
        script.Parent.Text = "Player Points Available: "..awardable
    end
    wait()
end

I removed most of the waits since they weren't necessary.

Ad

Answer this question