After getting the required amount of currency to craft an item a tool that is in lighting is supposed to go into the starter pack after clicking a text button. Nothing happens and the currencys do not decrease. Nothing is showing in the output so I am stuck trying to figure this out any help?
player = script.Parent.Parent.Parent.Parent.Parent.Parent
money = player.Envanter.Wood
rocks = player.Envanter.Tas
SM = player.Envanter.SpecialMaterials -- Change Money to the name of your leaderstats.
price = 45 -- Your price goes here.
tool = game.Lighting:FindFirstChild("OldAxe") -- Put the name of your tool here.
function buy()
if money.Value >= price and rocks.Value >= price and SM.Value >= price then
money.Value = money.Value - price
rocks.Value = rocks.Value - price
SM.Value = SM.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)

1 comment
Is your game FilteringEnabled true? If it is, then It could not work, because you change client values from a serverscript and this doesn't work well with FIlteringEnabled