Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Greater than or less than?[ANSWERED]

Asked by 10 years ago
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

Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

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
Ad

Answer this question