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

[SOLVED] How to make a GUI frame shake based on Health?

Asked by 5 years ago
Edited 5 years ago

So I have an HP bar and when the players health gets low it starts shaking.

I have this script in a local script in the GUI:

-- Vars up here

-- Changed function
hum.HealthChanged:Connect(function(Health) 
    local maxHealth = hum.MaxHealth
    local lowPercent = 0.15 * hum.MaxHealth
    local lowEnough = Health < lowPercent  -- when the player is below 15%

    if lowEnough then
        if healthFrame:FindFirstChild("ShakeScript") ~= nil then
            healthFrame:FindFirstChild("ShakeScript").Disabled = false
        end
    else
        if healthFrame:FindFirstChild("ShakeScript") ~= nil then
            healthFrame:FindFirstChild("ShakeScript").Disabled = true
        end
    end
end)

The scripts disable and re enable like they're supposed to but nothing happens.

0
it would be nice if you showed us the "ShakeScript" Clorize 31 — 5y
0
Shake script has nothing to do with my question. And you're commenting on a question long solved. SimpleFlame 255 — 5y

Answer this question