For my game i need an animation to play, and when the health changes it checks to see if it needs to change animation, but using this code it always gets this error
10:47:24.822 - Workspace.Tower.Dummy.Script:13: attempt to compare boolean and number
Here's the troublesome code: (if anyone can help me make a better less messy version of this code, it would be greatly appreciated)
local function CheckHealth()
if game.Workspace.Tower.Configuration.Health.Value > 75 then
local anim1 = script.Parent.Humanoid:LoadAnimation(script.FullAnim)
anim1.Looped = false
game.Workspace.Tower.sword1.Transparency = 0
anim1:Play()
elseif game.Workspace.Tower.Configuration.Health.Value < 50 then
if not game.Workspace.Tower.Configuration.Health.Value < 25 then
local anim2 = script.Parent.Humanoid:LoadAnimation(script.FiftyAnim)
anim2.Looped = false
game.Workspace.Tower.sword1.Transparency = 1
anim2:Play()
end
elseif game.Workspace.Tower.Configuration.Health.Value < 25 then
local anim3 = script.Parent.Humanoid:LoadAnimation(script.TwentyFiveAnim)
anim3.Looped = false
game.Workspace.Tower.sword1.Transparency = 1
anim3:Play()
elseif game.Workspace.Tower.Configuration.Health.Value == 0 then
game.Workspace.Fail:Play()
local anim4 = script.Parent.Humanoid:LoadAnimation(script.ZeroAnim)
anim4.Looped = false
game.Workspace.Tower.sword1.Transparency = 1
anim4:Play()
end
end

2 comments
My Eyes are bleeding Right now from looking at this code ! Please Indent more ! And Where is the line of error?
sorry about the messy code lol, i made it at 2am the error is on line 8