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

My no health regeneration script is not working! Is there something wrong?

Asked by 5 years ago

While making a game I was testing my custom health bar GUI. I set my health to something lower than 100 and it started to eventually get back to 100, I would be fine with it if it didn't get funky with a lot of decimals. So I made this script to try to delete the health regeneration script, but it's not working!

function deleteRegenScript(player)
    player.Character:WaitForChild'Health':Destroy()
end

game.Players.LocalPlayer.CharacterAdded:connect(deleteRegenScript)

Help would be appreciated.

0
math.floor()? User#20388 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Here, try this,

Server script located in ServerScriptService:

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
        if char then
            local healthScript = char:WaitForChild("Health")
            healthScript:Destroy() -- you can also disable the script using healthScript.Disable = true
        end
    end)
end)
Ad

Answer this question