Hello,
I am trying to make a simulator were you fill your bag and you can sell it so I want to make my int value be what the leader board stat says so if I have 10 sand I want the int value to be 10. The error is with something about the Local Player you can't use. https://gyazo.com/8a3af66a223b3e5768242da4c9c1adbf | https://gyazo.com/50568a4009de6c4e5a883daf92174cee | https://gyazo.com/cb02073da77441536890e1dd0b474a5c
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 --click view source, seems like the line is too long
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 -- Rename Backpack to your backpack's name, and make sure this script and the backpack is in ServerScriptService 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)
It realy easy you need to put the script in a normal script and
just change "script.Parent.Value" to where the int-value is and "sand.leaderstats.sand.Value" to where the sand's value is
and here is a example script:
while true do local player = game.Players.LocalPlayer script.Parent.Value = player.leaderstats.Sand.Value wait() end
If you must use a local script then you must make a normal script in the same place then put/past the script the