Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Greater than or less than?[ANSWERED]

wait(0.01)
local enabled = true
Player = game.Players.LocalPlayer
character = Player.Character
mouse = Player:GetMouse()
run = game:GetService("RunService")
Torso = Player.Character:WaitForChild("Torso")
Humanoid = Player.Character.Humanoid
Nen = Player.Nen

function onKeyDown(key)
	key = key:lower()
	if key == "r" then
		if Nen.Value >= 100  then
			Nen.Value = Nen.Value -5
		end
		game:GetService("Chat"):Chat(Player.Character.Head,"Ren!")
		local f = Instance.new("Fire")
		f.Heat = 15
		f.Size = 16
		f.Color = Color3.new(255, 255, 255)
		f.SecondaryColor = Color3.new(106, 106, 106)
		f.Parent = Torso
		Humanoid.MaxHealth = 150
		wait(5)
		Humanoid.MaxHealth = 100
		game.Debris:AddItem(f,0.1)
	end
end

mouse.KeyDown:connect(onKeyDown)

How do i make it to where if the number value(NEN) is greater then 100 or less then 100 it will still minus of the value by 5?

1 answer

✓ Accepted answer

If you want to know if y is less than or greater than but not equal to x, then just check if y doesn't equal x; which will mean that it is either greater or less than x.

In Lua, the format for doesn't equal is ~=.

if y ~= x then
	print("It's greater or less than x!")
end

This discussion is preserved as it was. New answers, comments, and votes are closed.