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.
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
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.
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.
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
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.