Hello, next time please use triple back ticks ``` to format your code in between like so
local player = game.Players.LocalPlayer
while wait() do
script.Parent.Text = player.leaderstats:WaitForChild(“Strength”).Value…"/"…game.ReplicatedStorage.Values.BackpackMax.Value
end
if player.leaderstats.Strength.Value >= game.ReplicatedStorage.Values.BackpackMax.Value then
game.StarterPack[“1 Pound Weight”].Animation.Disabled = true
else
game.StarterPack[“1 Pound Weight”].Animation.Disabled = false
end
And for your problem there are two possible problems:
Make sure your script is a local script and is inside a backpack, PlayerScripts, or anywhere explained by the dev API reference because:
--This only works for local players
local player = game.Players.LocalPlayer
Secondly try putting your if statement inside the while wait() do loop, this is so currently your code only checks the strength value once the local script runs.
so try this:
while wait() do
script.Parent.Text = player.leaderstats:WaitForChild(“Strength”).Value…"/"…game.ReplicatedStorage.Values.BackpackMax.Value
if player.leaderstats.Strength.Value >= game.ReplicatedStorage.Values.BackpackMax.Value then
game.StarterPack[“1 Pound Weight”].Animation.Disabled = true
else
game.StarterPack[“1 Pound Weight”].Animation.Disabled = false
end
end
If you put something inside the StarterPack, It will clone that and put the thing inside of every player’s backpack.
You are trying to disable the StarterPack’s Animation script. It won’t work because the script is not inside of the player’s backpack.
Instead of this, you should try : local weight = game.Players.LocalPlayer.Backpack:FindFirstChild("1 Pound Weight") weight.Animation.Disabled = true else weight.Animation.Disabled = false