Hi there! I've been working on some code for a backpack shop and it's not working. It's just not wanting to detect how much cash a player has. I got this output from the console
Argument 1 missing or nil
The code:
local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
playerGui.BackpackShopGui.Frame.TwoHundred.MouseButton1Click:Connect(function(plr)
if game.Players:FindFirstChild(plr.Name).leaderstats.Money.Value >= 500 then --// Where the error is
plr.leaderstats.Money.Value = plr.leaderstats.Money.Value - 500
plr.HiddenValues.BackpackCapacity.Value = 200
end
end)

3 comments
Correction to the console output: attempt to index nil with 'Name'
that means that using find first child retuned nil, so you should try a different aproch
Remove the argument from mouse button function..