Only half of the script works

hello, i’m making a tackle script, but theres a bug that i don’t see in the script, only half script works.
can someone please help me? Thanks! PS is a script in StarterCharacterScripts

local UserInputService = game:GetService("UserInputService")
local character = script.Parent


local humanoid = character:WaitForChild("Humanoid")
local Animator = humanoid:WaitForChild("Animator")
local Ball = game.Workspace.Boru
local deb = true
local debstu = true
local h = false
local function helo()
character.RightFoot.Touched:Connect(function(hit)
	if hit.Parent:WaitForChild('Humanoid', math.huge) then
			if debstu == true then
				
			debstu = false
				local hitchar = hit.Parent
				hitchar:WaitForChild('Tackle').Disabled = true
				hitchar:WaitForChild('TackleClient').Disabled = true
				if hitchar.Name == Ball.Owner.Value then
					Ball:WaitForChild('WeldConstraint'):Destroy()
					Ball.Velocity = Vector3.new(1 * 1 * 40) 
					hitchar.Pass.Disabled = true
					hitchar.Kick.Disabled = true
					hitchar.WeldBall.Disabled = true
							script.Parent.Kick.Disabled = false  
							h = true
							Ball.Owner.Value = character.Name


							local Weld = Instance.new("WeldConstraint")

							Weld.Parent = Ball 
							Ball.CastShadow = false

							Weld.Part0 = Ball
							Weld.Part1 = character.HumanoidRootPart

							Ball.Orientation = Vector3.new(0,0,0)
					Ball.Position = character:FindFirstChild('WeldPart').Position
					
					
					
					-- From this part it don't Work :/
					
					
			
			
				local hitHum = hitchar:FindFirstChild('Humanoid')
			local Animator = hitHum:WaitForChild("Animator")
			local TackleStunAnimation = Instance.new("Animation")
			TackleStunAnimation.AnimationId = "rbxassetid://10500976679"
			local TackleStunAnimationTrack = Animator:LoadAnimation(TackleStunAnimation)
			TackleStunAnimationTrack:Play()
					hitHum.WalkSpeed = 0
				wait(3.3)
				hitHum.WalkSpeed = 16
				hitchar.WeldBall.Disabled = false

			TackleStunAnimationTrack:Stop()	
			wait(5)
				hitchar:WaitForChild('Tackle').Disabled = false
				hitchar:WaitForChild('TackleClient').Disabled = false
					debstu = true
				end
			end
		end
	end)
end
script.Parent.TackleEv.OnServerEvent:Connect(helo)

What doesn’t work? Does the function not work?

the function works, but only half, you see theres a point that i signed with 'From this part it don’t work ’ and i don’t know why!!

does it error or does it just not work

edit: it could be something to do with the waitforchilds

no there’s no error in the output

if u add like print statements through the rest of the lines do they print or nah

no, even if i try with print it don’t work

deos it get disabled or something?

yes, but the enemy one, not the player one, and the player one wait like 8 secs and reable the enemy one, but it don’t work beacouse the hit enemy don’t even do the animation that it should do!!

--This is the Part of the script when the hit humanoid should do that anim
--From there the script don't work


	local hitHum = hitchar:FindFirstChild('Humanoid')
			local Animator = hitHum:WaitForChild("Animator")
			local TackleStunAnimation = Instance.new("Animation")
			TackleStunAnimation.AnimationId = "rbxassetid://10500976679"
			local TackleStunAnimationTrack = Animator:LoadAnimation(TackleStunAnimation)
			TackleStunAnimationTrack:Play()

I dont see why it just doesnt work. Sorry

i fixed it, i just added to reable it when a event changed, anywany, thanks!!

1 Like