I don't quite understand how <= and >= works

  1. What do you want to achieve?
    I am currently working on a small little project where there are tons of things to do and one of them involves turning off the “artificial air generator 2.0” I decided to make a special currency for doing that
    in which you need 2 of that currency to turn off the “artificial air generator 2.0”

  2. What is the issue?
    The issue here is that it always thinks that I have less than 2 Energy Magnets

    (Image where I have more than 2)

  3. What solutions have you tried so far?
    I have tried to switch the places of the options inside the code but that just made the player able to turn off the air generator with 0 energy magnets. I tried looking for some solutions on the developer hub but I couldn’t find any.

local button = script.Parent
local UI = game.ServerStorage.Confirm


button.mouseClick:connect(function(plr)
	if plr["Energy Magnets"].Value >= 2 then
		UI.Title.Text = "Are you sure you want to spend 2 energy magnets to turn off the air generator?"
	elseif plr["Energy Magnets"].Value <= 2 then
		UI.Title.Text = "You need 2 energy magnets to turn off the air generator!"
		UI.Yes.Visible = false
		UI.No.Visible = false
		UI.Ok.Visible = true 
	end
	
	local a = UI:Clone()
	a.Parent = plr.PlayerGui.UI
end)

x >= y: x is greater than or equal to y
x <= y: x is less than or equal to y

 elseif plr["Energy Magnets"].Value <= 2 then

Here is your problem, this should be < and not <=

x >= y and x <= y is just x > y or x == y and x < y or x == y.

hmm. I tried that and it still doesn’t quite seem to work, it still says I need 2 despite having 3

Change to the server view in Studio and confirm that the server knows you have more than two magnets. (Maybe you’re adding magnets in a local script?)

That’s true. @RealAveryden click Play Button then click Server and then change the Value of the Magnets.

It should work in this case.

That seemed to be the problem. The server wasn’t registering any of the magnets getting added. But his solution did work. I just had to change the magnet value through the server.