I have this Shop GUI, and it is not working, here is the code:
player = script.Parent.Parent.Parent.Parent.Parent
money = player.leaderstats.Money
price = 150
tool = game.Lighting:findFirstChild("Katana")
function buy()
if money.Value >= price then
money.Value = money.Value - price
local a = tool:clone()
a.Parent = player.Backpack
local b = tool:clone()
b.Parent = player.StarterGear
end
end
script.Parent.MouseButton1Down:connect(buy)
And here is the error:
18:34:34.407 - leaderstats is not a valid member of Player
18:34:34.407 - Script 'Players.Player1.PlayerGui.ShopGUI.ShopFrame.Katana.Main', Line 2
18:34:34.408 - Stack End
Any help is appreciated, thanks!
This script is in a button in StarterGui

2 comments
Needs to be Local I believe. Local Script
No, I just rewrote the code anyway, thanks anyway!