It’s self explanatory, how can i make a injured animation when the player is like less than 50 health then it plays another animation and when it is not, it switches back to the default all using better animate? I know how to make the change animation, but back to default, that is what im having problem, how could i do it?
burger burger burger burger burger burger
what, you serious? Instead of answering anything that comes to your mind, could you please just say something to help me instead of saying… that?
you could use the Humanoid.HealthChanged function to detect if the health is lower, then play or stop the animation
Yes yes i know, but do you know the better animate module? I want to use it to change the animations in real time. also, the roblox animate script sucks, so that’s why im using that module.
Nevermind i fixed it, although, if anyone’s having a problem with this or just wanna try it out, here it is
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local BetterAnimate = require(game:GetService("ReplicatedStorage").Modules.BetterAnimate)
local InitSettings = {Enabled_Inverse = true} -- You can change it later in MyAnimator.Settings
local InjuredAnimations = {
Walk = {{ID = 91372017090902}},
Run = {{ID = 91372017090902}}
}
local MyAnimator = BetterAnimate.New(Character, InitSettings)
MyAnimator:Start()
local DefaultAnimations = {}
for class, animations in pairs(MyAnimator.Class_Animations) do
DefaultAnimations[class] = {}
for index, data in pairs(animations) do
table.insert(DefaultAnimations[class], {
ID = data.ID,
Weight = data.Weight,
})
end
end
--local OldHealth = Humanoid.Health
local isInjured = false
Humanoid.HealthChanged:Connect(function(health)
if health < 50 and not isInjured then
isInjured = true
MyAnimator:UpdateAnimations(InjuredAnimations, true)
elseif health >= 50 and isInjured then
isInjured = false
MyAnimator:UpdateAnimations(DefaultAnimations, true)
end
end)
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.