Players.Leone984.PlayerGui.ScreenGui.Frame.TextButton.LocalScript:7: Expected 'then' when parsing if statement got '='

local plr = game.Players.LocalPlayer
local leader = plr.leaderstats.Kills
local price = script.Parent.Cost.Value
local tool = game.Lighting.Sword

function buy()
	if leader.Value >= price then
		leader.Value = leader.Value - price
		
		local a = tool:Clone()
		
		a.Parent = plr.Backpack
		
		local b = tool:Clone()
		
		b.Parent = plr.StarterGear
end		
	end
	script.Parent.MouseButton1Click:Connect(buy)

I did a leaderstats shop but it doesn’t work and it gives this error: Players.Leone984.PlayerGui.ScreenGui.Frame.TextButton.LocalScript:7: Expected ‘then’ when parsing if statement got ‘=’ and I don’t know how to fix it. Could you help me? Thank you.

Although this may not be related to your error, I think you’re supposed to do this on the if statement

if leader.Value >= price.Value then
 -- other stuff
end

and not

if leader.Value >= price then
 --other stuff
end

as I’m pretty sure the Cost variable is an instance, not an integer.

PS: Use RemoteEvents, as your script can easily be exploited the hell out of and the change is only client sided, so the server won’t see that you’ve bought the sword.