Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.