-
What do you want to achieve?
I am trying to mirror a leaderboard IntValue to a text label connected to a BillboardGui that is located inside of a model. -
What is the issue?
No matter what I do it doesn’t mirror the value of hunger. -
What solutions have you tried so far?
I tried asking other developers what the problem was but no one knew
Hey all, so I’m pretty new to scripting and I need some help.
This is the code inside ServerScriptService handling the leaderboard that I made.
local Doge = game.Workspace.DogeModel.HumanoidRootPart
local leaderboard = Instance.new("Folder", Doge)
leaderboard.Name = "HungerStats"
local Hunger = Instance.new("IntValue", leaderboard)
Hunger.Name = "HungerValue"
Hunger.Value = 100
hungerTrue = true
local hungerValue = Hunger.Value
local function dogeHunger ()
while hungerTrue == true do
hungerTrue = true
wait(5)
Hunger.Value = Hunger.Value - 1
print(Hunger.Value)
end
end
dogeHunger()
This is the code inside of the model I was talking about earlier:
local doge = game.Workspace.DogeModel.HumanoidRootPart
local leaderboard = doge:WaitForChild("HungerStats")
local Hunger = leaderboard.HungerValue
local value = script.Parent
value.Text = "Hunger: "..Hunger.Value
Hunger:GetPropertyChangedSignal("Value"):Connect(function()
value.Text = "Hunger: "..Hunger.Value
end)
