Why wont anim:Stop work?

i have been trying to make this blocking system but anim:stop wont work

function bLOCK ()
local anim = Player.Character.Humanoid:LoadAnimation(script.Block)	
	if uis2:IsKeyDown(Enum.KeyCode.F) then
	
		if db == true then return end
	
	if blocking == false then
	
	
	blocking = true
	db =true	
	block:FireServer(click,uis2)
anim:Play()
	


	Player.Character.Humanoid.JumpPower = 0

	wait(0.4)
	db =false
	

	end	
	elseif not uis2:IsKeyDown(Enum.KeyCode.F) then
		if blocking == true then
			blocking = false
			anim:Stop()
	
		end
	end
		
	
	end

try using :print() to debug that. maybe its not actually going to the part asking for it to stop?
blocking might not actually be true, idk how but im attempting.

it prints hello but still not stopping animation

Try moving the animation variable outside the function:

local anim = Player.Character.Humanoid:LoadAnimation(script.Block)

function bLOCK ()	
	if uis2:IsKeyDown(Enum.KeyCode.F) then
	
		if db == true then return end
	
	if blocking == false then
	
	
	blocking = true
	db =true	
	block:FireServer(click,uis2)
anim:Play()
	


	Player.Character.Humanoid.JumpPower = 0

	wait(0.4)
	db =false
	

	end	
	elseif not uis2:IsKeyDown(Enum.KeyCode.F) then
		if blocking == true then
			blocking = false
			anim:Stop()
	
		end
	end
		
	
	end
1 Like

Whenever you made the BLOCK() function. You also need to call it.

A function is just a way to execute multiple lines of code in one call, basically making a function is just making the blueprints of your desires.

But you need to call the function to execute the blueprint!

i called it using cas (content action service) i just didnt show it

THank you smmmmmm,mmmmmmmmmmmmmmmmmmmmmmm

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.