if game.Players.LocalPlayer then local player = game.Players.LocalPlayer local currency = player:WaitforChild('leaderstats').Money local amount = 1100 local tool = game.Lighting["AK-47"] connect (function(plr) if currency >= amount and not player.Backpack:FindFirstChild('AK-47') or player.Character:FindFirstChild('AK-47') then currency.Value = currency.Value - amount local tool = tool:Clone() tool.Parent = plr.Backpack end
Seems like you forgot some ends. But the first if
statement is redundant, so you should be good with just adding one to close your attempt at setting up an event on line 6.
And secondly, it seems like you're attempting to connect an event.. but you haven't defined the event that you're connecting. There's no way for me to know what object or event you're trying to connect the function to so you're just gonna have to fix that.
local player = game.Players.LocalPlayer local currency = player:WaitforChild('leaderstats').Money local amount = 1100 local tool = game.Lighting["AK-47"] someobject.someEvent:connect(function(plr) --YOU NEED TO FIX THIS if currency >= amount and not player.Backpack:FindFirstChild('AK-47') and not player.Character:FindFirstChild('AK-47') then currency.Value = currency.Value - amount local tool = tool:Clone() tool.Parent = plr.Backpack end end)
Closed as Non-Descriptive by Goulstem
This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.
Why was this question closed?