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

Is there any way that I can get this currency gui to constantly check the value?

Asked by 5 years ago
1game.Players.LocalPlayer.leaderstats.Zimo.Changed:Connect(function()
2    script.Parent.Text = game.Players.LocalPlayer.leaderstats.Zimo.Value
3end)

Im trying to get this to constantly check the value/currency or when the player connects cause I have a data store set up and when a player joins it doesn't update the value.

I have also tried

1game.Palyers.PlayerAdded:Connect(function()
2    script.Parent.Text = game.Players.LocalPlayer.leaderstats.Zimo.Value
3end)

But I can't get it to work its my first time coding on roblox and basically anything and im trying to get into it so if i could get some help that would be amazing!

0
Are you using local script or regular script? DbExpress 20 — 5y

2 answers

Log in to vote
0
Answered by
Lunaify 66
5 years ago

I'm writing this from the top of my head, so i'm not sure if this script will function properly (Also i recommend looking up FilteringEnabled in the near future)

-This Code is an example by the way, if you are going to use it then make sure to just update the variables n' stuff

1local Player = game.Players.LocalPlayer
2local Zimo = Player:WaitForChild("leaderstats"):WaitForChild("Zimo")
3 
4script.Parent.Text = Zimo.Value
5Zimo.Changed:connect(function()
6    script.Parent.Text = Zimo.Value
7end)

i think this will work, im not sure though

0
This worked! Thanks surferJG4 2 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

You could do a loop to constantly check for any changes but Lunaify's method would be better to use.

1local Player = game.Players.LocalPlayer
2local Zimo = Player:WaitForChild("leaderstats"):WaitForChild("Zimo")
3 
4while true do
5wait()
6    script.Parent.Text = Zimo.Value
7end)

Or

1local Player = game.Players.LocalPlayer
2local Zimo = Player.leaderstats.Zimo
3 
4Zimo.Changed:connect(function()
5    script.Parent.Text = Zimo.Value
6end)

Answer this question