1 | game.Players.LocalPlayer.leaderstats.Zimo.Changed:Connect( function () |
2 | script.Parent.Text = game.Players.LocalPlayer.leaderstats.Zimo.Value |
3 | end ) |
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
1 | game.Palyers.PlayerAdded:Connect( function () |
2 | script.Parent.Text = game.Players.LocalPlayer.leaderstats.Zimo.Value |
3 | end ) |
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!
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
1 | local Player = game.Players.LocalPlayer |
2 | local Zimo = Player:WaitForChild( "leaderstats" ):WaitForChild( "Zimo" ) |
3 |
4 | script.Parent.Text = Zimo.Value |
5 | Zimo.Changed:connect( function () |
6 | script.Parent.Text = Zimo.Value |
7 | end ) |
i think this will work, im not sure though
You could do a loop to constantly check for any changes but Lunaify's method would be better to use.
1 | local Player = game.Players.LocalPlayer |
2 | local Zimo = Player:WaitForChild( "leaderstats" ):WaitForChild( "Zimo" ) |
3 |
4 | while true do |
5 | wait() |
6 | script.Parent.Text = Zimo.Value |
7 | end ) |
Or
1 | local Player = game.Players.LocalPlayer |
2 | local Zimo = Player.leaderstats.Zimo |
3 |
4 | Zimo.Changed:connect( function () |
5 | script.Parent.Text = Zimo.Value |
6 | end ) |