✓ Accepted answer
The reason this isn't working is because your local script appears to be located under workspace.
Localscripts must be parented to services such as StarterGui, StarterPack, and StarterPlayer to work.
If you really want this change to be done on the client (meaning only the player will have this value changed for them, after putting the localscript in an apropriate parent
workspace.Part.CurrentOre.Value=game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Sand").Value
Update:
Changed the checker to the server where the backpack is created
game.Players.PlayerAdded:Connect(function(Player)
local sand=Player:WaitForChild("leaderstats"):WaitForChild("Sand")
Player.CharacterAdded:Connect(function(Character)
local bucket= script.Parent.BasicBag:Clone()
bucket.Parent = Character
local function change()
bucket.Handle.Part.CurrentOre.Value=sand.Value
bucket.Handle.Part.SurfaceGui.TextLabel.Text=sand.Value.."/"..bucket.Handle.Part.MaxOre.Value
end
sand.Changed:Connect(change)
change()
end)
end)
2 comments
Provide the error made by the console
Is this in a server script? If so it won't work.