Can't mirror leaderboard IntValue to BillboardGui

  1. 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.

  2. What is the issue?
    No matter what I do it doesn’t mirror the value of hunger.

  3. 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)

If I’m understanding correctly, and the second bit of code is inside a model, “value” would refer to the model (as script.Parent). This wouldn’t have a Text property

Sorry for the confusion, the script is located here
aaaa

The second parameter of instance.new() is deprecated, just parent it with a different line of code instead
Also, I think you should be putting the code that takes away the hunger INSIDE the model script, and instead of using an instance.new() function, just create a value yourself, it’ll be easier to manage