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

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

game.Players.LocalPlayer.leaderstats.Zimo.Changed:Connect(function()
	script.Parent.Text = game.Players.LocalPlayer.leaderstats.Zimo.Value
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

game.Palyers.PlayerAdded:Connect(function()
	script.Parent.Text = game.Players.LocalPlayer.leaderstats.Zimo.Value
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!

1 comment

0

Are you using local script or regular script?

2 answers

✓ Accepted answer

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


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

script.Parent.Text = Zimo.Value
Zimo.Changed:connect(function()
	script.Parent.Text = Zimo.Value
end)


i think this will work, im not sure though

1 comment

0

This worked! Thanks

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

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

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

Or

local Player = game.Players.LocalPlayer
local Zimo = Player.leaderstats.Zimo

Zimo.Changed:connect(function()
    script.Parent.Text = Zimo.Value
end)

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