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 4 years ago
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!

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

2 answers

Log in to vote
0
Answered by
Lunaify 66
4 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


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

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

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)

Answer this question