Script not detecting if player score stats is less than certain number

local Debounce = false
game.ReplicatedStorage.Events.Banner.OnServerEvent:Connect(function(Player)
if not Debounce then
Debounce = true
if Player.leaderstats.Score.Value == 2000 or 2000 < Player.leaderstats.Score.Value then
local Tool = Player.Backpack:FindFirstChild(“Buff Banner”) or Player.Character:FindFirstChild(“Buff Banner”)
if not Tool then
local Conch = Player.Backpack:FindFirstChild(“Concheror”) or Player.Character:FindFirstChild(“Concheror”)
if Conch then
Conch:Destroy()
end
script[“Buff Banner”]:Clone()
script[“Buff Banner”]:Clone().Parent = Player.Backpack
Player.leaderstats.Score.Value = Player.leaderstats.Score.Value - 2000
game.ReplicatedStorage.Events.Success:FireClient(Player)
if Player.leaderstats.Score.Value < 2000 or Tool then
game.ReplicatedStorage.Events.Fail:FireClient(Player)
end
end
end
wait(1.25)
Debounce = false
end
end)

This code is for a shop gui thing, and the part where it says ’ if Player.leaderstats.Score.Value < 2000 or Tool then
game.ReplicatedStorage.Events.Fail:FireClient(Player)
end’
isn’t working except for the (or Tool) part of it. It’s like it isn’t checking if the player’s score is less than 2000.
Also, the success and fail events are used to tell the player if their purchase was successful or not. If it’s a success, you get a sound that says “Sweet,” and if it is a fail, a loud “NOPE” yells at you. If you already have that tool, “NOPE,” if you don’t have enough money and click it, it doesn’t yell at you. Any help?

that’s because you’re always checking if the player has less than 2000, after already subtracting it. You don’t have any conditions set to check for the success so it always clears the first one, and if they have less than 2000 afterwards, it’ll always do both.

Hey!

When you’re sending code, make sure to wrap them in code blocks to make it easier for people to read. You can put your code into a code block by adding ```lua one line above the beginning your code and ``` one line below the end of your code.

Example:

```lua
YOUR CODE GOES HERE
```

I do not understand* you very well. Can you please try saying it in simpler way?

line 5

if Player.leaderstats.Score.Value == 2000 or 2000 < Player.leaderstats.Score.Value then

can be better written as

if Player.leaderstats.Score.Value >= 2000 then

but moving on from this, if you go to line 14 to line 18

Player.leaderstats.Score.Value = Player.leaderstats.Score.Value - 2000
game.ReplicatedStorage.Events.Success:FireClient(Player)
if Player.leaderstats.Score.Value < 2000 or Tool then
	game.ReplicatedStorage.Events.Fail:FireClient(Player)
end

it always checks for this fail condition after already subtracting points and firing the ‘Success’ event.

This means that if they have that “2000” score value, it then subtracts it from them, fires the success client. It then continues and if they have a score less than 2000 it will also clear your Fail remote condition.

I edited one a bit, but it still won’t play the deny sound when player doesn’t have enough money

'local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local Debounce = false
ReplicatedStorage.Events.Banner.OnServerEvent:Connect(function(Player)
if not Debounce then
Debounce = true
if Player.leaderstats.Score.Value >= 2000 then --Player has enough score

		local Tool = Player.Backpack:FindFirstChild("Buff Banner") or Player.Character:FindFirstChild("Buff Banner")
		
		if not Tool then --If player doesn't already have tool
		
			script["Buff Banner"]:Clone()
			script["Buff Banner"]:Clone().Parent = Player.Backpack --Clone tool to player's backpack
			
			Player.leaderstats.Score.Value = Player.leaderstats.Score.Value - 2000 --Subtract player's score
			
			ReplicatedStorage.Events.Success:FireClient(Player) --Play Success Sound
			
			local Conch = Player.Backpack:FindFirstChild("Concheror") or Player.Character:FindFirstChild("Concheror")

			if Conch then
				Conch:Destroy() --Delete Other Buff Tool
			end
			
		elseif Player.leaderstats.Score.Value < 2000 or Tool then --Player doesn't have enough score
			
				ReplicatedStorage.Events.Fail:FireClient(Player) --Player Deny Sound
		end
	end
	wait(1.25)
	Debounce = false
end

end)