local player = game.Players.LocalPlayer local leaderboard = player:WaitForChild("leaderstats") local button = script.Parent local price = button:WaitForChild ("Price") local item = button:WaitForChild ("ItemName") local rs = game:GetService ("ReplicatedStorage") found = false if player.Backpack:FindFirstChild('Normal Key') then found = true end button.MouseButton1Click:connect(function() if leaderboard.Money.Value >= price.Value and found == false then leaderboard.Money.Value = leaderboard.Money.Value - price.Value local item = rs:WaitForChild(item.Value) item:Clone().Parent = player.StarterGear item:Clone().Parent = player.Backpack end end)
You should change your code to like this:
button.MouseButton1Click:connect(function() if player.Backpack:FindFirstChild('Normal Key') and leaderboard.Money.Value >= price.Value then leaderboard.Money.Value = leaderboard.Money.Value - price.Value local item = rs:WaitForChild(item.Value) item:Clone().Parent = player.StarterGear item:Clone().Parent = player.Backpack else button.Text = You already have this item! end end)
That's should be the code, make sure then is on the same line as the if statement.