Currency Gui Not working

I have a Currency Gui, it was working but then it just stopped working, I don’t know why…

Script of the Currency Gui:

local plr = game.Players.LocalPlayer
local leaderstats = plr:WaitForChild("leaderstats")
local Slimes = leaderstats:WaitForChild("Slimes")

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

I have my leaderstats, but it is still not working.

If anyone knows what is the problem I would appreciate their help.

try checking console and also converting slimes value to string by tostring(Slimes.Value)

1 Like

Hey there, I recommend you don’t use a loop instead use .Changed!


local plr = game.Players.LocalPlayer
local leaderstats = plr:WaitForChild("leaderstats")
local Slimes = leaderstats:WaitForChild("Slimes")

Slimes.Changed:Connect(function(NewValue)
	script.Parent.Text = NewValue
end

Also check the output.

3 Likes

Instead of using .Changed, try using :GetPropertyChangedSignal(“Value”)

Both work however they do a similar thing. .Changed listens for any change in general. However GetPropertyChangedSignal(“Value”) only listens for the value change. This does not matter for values because it’s not like he is changing the name of the value in game.

1 Like

It isn’t working, but I think i know why, Here at script.Parent.Text = NewValue
end
Under NewValue and end is red line that means that something is wrong, idk if I did something wrong or you did, help.

you forgot the ) after end
chars

It is not working, what should I do now?

Never use while wait() do and instead use the GetPropertyChangedSignal method.

Is this a script or a local script?

local plr = game.Players.LocalPlayer
local leaderstats = plr:WaitForChild("leaderstats")
local Slimes = leaderstats:WaitForChild("Slimes")

Slimes.Changed:Connect(function(NewValue)
	script.Parent.Text = tostring(NewValue)
end)

try this

Try

local plr = game.Players.LocalPlayer
local leaderstats = plr:WaitForChild("leaderstats")
local Slimes = leaderstats:WaitForChild("Slimes")

while wait() do
        wait(0.2)
	script.Parent.Text = Slimes.Value
end 

thats so unoptimized wth
waiting 0.2 seconds in a wait() loop??!?!

I dunno, I used this in time script, and it worked :person_shrugging:

It is not working idk what is happening?!

local Player = game.Players.LocalPlayer
local ls = Player.leaderstats
local Slimes = ls:WaitForChild("Slimes")

script.Parent.Text = tostring(Slimes.Value)

Slimes:GetPropertyChangedSignal("Value"):Connect(function()
	script.Parent.Text = tostring(Slimes.Value)
end)

This is a working script, if it doesn’t work then there is an issue with the leaderstats.

Why is is tonumber and not tostring? Thats just gonna error “expected string got number :nerd:

Did you ever literally in this entire thread ever check the dev console?

It is not working :// I guess it is leaderstats

Send through the leaderstats script.

Does it ever say anything about “yielding”?