Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to fix this GUI?

Asked by 9 years ago

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

0
Needs to be Local I believe. Local Script NinjoOnline 1146 — 9y
0
No, I just rewrote the code anyway, thanks anyway! ggggyourface23 63 — 9y

Answer this question