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

The Label doesn't display the Costs of the Rebirth?

So I want the label to show how much the Rebirth Costs but it only displays 0 no matter how much rebirths the player has. *- The Player starts with 1 Rebirth

  • Theres nothing wrong with the Locals
  • Its not a LocalScript*
local plr = script.Parent.Parent.Parent.Parent.Parent.Parent
local dinbux = script.Parent.Parent.Parent.Parent.Parent.Parent.leaderstats.DinBux
local rebirths = script.Parent.Parent.Parent.Parent.Parent.Parent.leaderstats.Rebirths
local label = script.Parent

while true do
	label.Text = "Rebirth Costs: "..(rebirths.Value * 1000000).." DB"
end

Thanks in Advance!

  • DindinYT37

2 answers

✓ Accepted answer

The problem is that the script doesn't renew the variables, cuz the script just get them once. Put the variables in the while wait so it renews the variables each time the script runs the loop:

while true () do
	local plr = script.Parent.Parent.Parent.Parent.Parent.Parent
	local dinbux = script.Parent.Parent.Parent.Parent.Parent.Parent.leaderstats.DinBux
	local rebirths = script.Parent.Parent.Parent.Parent.Parent.Parent.leaderstats.Rebirths
	local label = script.Parent
	label.Text = "Rebirth Costs: "..(rebirths.Value * 1000000).." DB"
end

Also, you need a waiting time. I added a () at the while wait. We are not obligated to put numbers in that (). Without numbers in that (), the script will just redo the loop each time the previous loop has finished.

Hope this helped!

Assuming all of your variables are correct, you need to fix your infinite loop changing label's text. To fix this, you can add a wait(time) within the loop.

Here is the script:

local plr = script.Parent.Parent.Parent.Parent.Parent.Parent
local dinbux = script.Parent.Parent.Parent.Parent.Parent.Parent.leaderstats.DinBux
local rebirths = script.Parent.Parent.Parent.Parent.Parent.Parent.leaderstats.Rebirths
local label = script.Parent

while true do
	label.Text = "Rebirth Costs: "..(rebirths.Value * 1000000).." DB"
	wait(1)
end

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