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

Kicking someone for exploiting health function?

Asked by 7 years ago
Edited 7 years ago

So basically, when a player god modes themselves, their health is "1.#INF" in Humanoid. I tested this and it didn't work. Any problems with it? Nothing came up on the dev console.

local infHealth = "1.#INF"


game.Workspace.ChildAdded:connect(function(Child)
    local Humanoid = Child:FindFirstChild("Humanoid")
    local Player = game.Players:FindFirstChild(Child.Name)

    if Humanoid then
        Humanoid.Changed:connect(function()
            if Player and Humanoid.MaxHealth == infHealth then
                Player:Kick("You have lost connection to the game")
            end
        end)
    end
end)
0
Suggest to just check if its bigger then 1000 or so. RubenKan 3615 — 7y
0
Really you could just check if it is greater than 100. xXLegendarySoldierXx 129 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Well first off, 1.#INF is a number, not a string. Yes, it appears as a string of characters, but it represents an infinite numeric value. You could test this by using type to get it's data type:

-- math.huge is a constant that's meant to represent an infinite quantity.
print(math.huge) -- > 1.#INF
print(type(math.huge)) -- > number

What you should be doing, is comparing the MaxHealth value to math.huge (assuming the "god health" has been set to this value). You should see a change in result after implementing that comparison. For example: if human.MaxHealth == math.huge then ..., etc. Hope this helped, let me know if you have any questions.

0
Instead of relying on humanoid health just make an double value and plqce it in the player model scottmike0 40 — 7y
Ad

Answer this question