i need help because whenever i test it the output says Workspace.buy ak47.Script:16: 'end' expected (to close 'function' at line 6) near ''
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"] script.Parent.ClickDetector.mouseClick: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 newtool = tool:Clone() newtool.Parent = plr.Backpack
end

2 comments
Please put your code in a code block. Thanx. c;
We're not your code monkeys. Explain what you're trying to do, and what is or isn't happening. Don't just throw code at us, also format your code correctly in Lua code block.