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

Im trying to make a backpack script but Wheat does not seem to increase in value on the textlabel?

local BackPack = script.Parent.BackPack

local Player = game.Players.LocalPlayer

local Wheat = Player.leaderstats.Wheat

local Storage = script.Parent.Storage.Value

local Storage = "25"

  

BackPack.Text = Player.leaderstats.Wheat.Value.."/"..Storage

if Wheat.Value == Storage then return end

1 answer

✓ Accepted answer

This is because you have only set the textlabel once in the script meaning it would only run once. If you want it to change: use the Changed event like this:

    local BackPack = script.Parent.BackPack
    
    local Player = game.Players.LocalPlayer
    
    local Wheat = Player.leaderstats.Wheat
    
    local Storage = script.Parent.Storage.Value
    
    local Storage = "25"
    
      
    
    BackPack.Text = Player.leaderstats.Wheat.Value.."/"..Storage
    Wheat.Changed:Connect(function() -- when wheat changes it will fire this function
		BackPack.Text = Player.leaderstats.Wheat.Value.."/"..Storage
    end)
    
    if Wheat.Value == Storage then return end

1 comment

0

Thank you very much!

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