I have this fighting i made code but i want to make it overide the defulat animations when this is running the main problem is in the claw code it makes the player spin and when its theres a varible spin when its 0 the animaiton plays when its 1 it stops

but if i press w before it starts spinning and then press e to start the spinning its fine but i release e defulat animations kick in and it will try to use the spin but it just stops


_G.Style = 1
_G.Attd = true
KeyDown = false
-- Import animation
local animation = Instance.new("Animation")
animation.AnimationId = "https://www.roblox.com/library/?id=980209840"

local Znimation = Instance.new("Animation")
Znimation.AnimationId = "https://www.roblox.com/catalog/?id=1016062430"

local Animation = Instance.new("Animation")
Animation.AnimationId = "https://www.roblox.com/library/?id=1011895663"

local Attacks = 1
local player = game.Players.LocalPlayer.Character
local animTrack = nil
local animTrack2 = nil
local canPlay = true
	animTrack = player.Humanoid:LoadAnimation(animation)
   animTrack2 = player.Humanoid:LoadAnimation(Animation)
  animTrack3 = player.Humanoid:LoadAnimation(Znimation)
local function onKeyPress(inputObject, gameProcessedEvent)
	if inputObject.KeyCode == Enum.KeyCode.E and KeyDown == false  and _G.Style == 1 then
		KeyDown = true
			print(_G.Style)
			print(_G.Attd)
_G.Attd = true
if Attacks ==3
	then
	Attacks = 2
end	

	
	if Attacks == 1
		then		
	
			animTrack:Play()
			Attacks = 3
	end
	
	
		
	if Attacks == 2
		then		
		
			animTrack2:Play() 
				Attacks =1
	end	

if inputObject.KeyCode == Enum.KeyCode.E and KeyDown == true then
	return Attacks
end
end
	KeyDown = false
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)


--==============CLAW STYLE=============---------------------------------------------------------------------------------------------------------------------
local Stage1 = Instance.new("Animation")
Stage1.AnimationId = "https://www.roblox.com/library/?id=1032395146"

local Attacks = 1

local player = game.Players.LocalPlayer.Character
local Stage1A = nil
	Stage1A = player.Humanoid:LoadAnimation(Stage1)
local Spin = 0

local function onKeyPress(inputObject, gameProcessedEvent)
	if inputObject.KeyCode == Enum.KeyCode.E and _G.Style == 2 then
	print(Spin)	
	print(_G.Attd)
_G.Attd = true
	
	
if Spin == 0
	then
	Spin = 1
else

if Spin == 1
	then
	Spin = 0
end
end
	end
	end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)

while true do
	wait(.2)

if Spin == 1
	then
	_G.Attd = false
		Stage1A:Play()
	
end
if Spin == 0
	then
		Stage1A:Stop()
		_G.Attd = true
	
end
end


1 comment

0

Read my bio.