The blur stops well, but animation doesn't stop. Pls fix this script.

script.Parent:WaitForChild("Humanoid")
local UIS = game:GetService('UserInputService')
local Player = game.Players.LocalPlayer
local Character = Player.Character
--Low Health
while true do
	if script.Parent.Humanoid.Health <= 15 then
		Character.Humanoid.WalkSpeed = 2
		Character.Humanoid.JumpPower = 0
		game.Lighting.Blur.Enabled = true
		local Anim = Instance.new('Animation')
		Anim.AnimationId = 'rbxassetid://6301546574'
		PlayAnim = Character.Humanoid:LoadAnimation(Anim)
		PlayAnim:Play()
	else
		if script.Parent.Humanoid.Health >= 15 then
			game.Lighting.Blur.Enabled = false
			Character.Humanoid.WalkSpeed = 16
			Character.Humanoid.JumpPower = 50


		end				
	end	
	wait(0.1)	
end


--Medium Health
while true do
	if script.Parent.Humanoid.Health >= 15 then
		Character.Humanoid.WalkSpeed = 2
		Character.Humanoid.JumpPower = 0
		game.Lighting.Blur.Enabled = true
		local Anim = Instance.new('Animation')
		Anim.AnimationId = 'rbxassetid://6301546574'
		PlayAnim = Character.Humanoid:LoadAnimation(Anim)
		PlayAnim:Stop()
	else
		if script.Parent.Humanoid.Health >= 15 then
			game.Lighting.Blur.Enabled = false
			Character.Humanoid.WalkSpeed = 16
			Character.Humanoid.JumpPower = 50
		end				
	end	
	wait(0.1)	
end

2 comments

0

For sure the animation that isn't working with the character type or something like that, the script seems fine to me.

0

Also put a wait(0.1) after the while true do or it can be laggy.