Script runs once, and then it wont run anymore?

So I have a script. and it is playing the animation in the script.
Its just not destroying the character.

Ill leave notes so you know whats going on

elseif typeOf == Enum.KeyCode.Two then
		warn('Rocket kick')
		local details = mod.AttackDetails.rocketKick
		local Distance = details.detectDistance
		local dmg = details.damage
		local KB = details.knockback
		local anim = anims.rocketkick
		-- get po1 and po2
		local po1 = char.PrimaryPart.Position
		local lootAt =, mousePo)
		root.Anchored = true
		root.CFrame = lootAt
		-- get po2
		local po2 = getPo2(Distance,char)
		local direction = po2 - po1
		-- make sure that we dont fire the same thing twice.
		local num = currentRocketNum + 1
		-- ignore parts
		local ignoreParts = {table.unpack(player.Character:GetChildren())}
		local params =

		params.FilterDescendantsInstances = {ignoreParts}
		params.IgnoreWater = true
		params.FilterType = Enum.RaycastFilterType.Blacklist
		-- send a raycast
		local raycast = workspace:Raycast(po1,direction,params)
		if raycast then -- this is where I fire the raycast. Yes it is hitting things, This part is running.
			-- move them to the hit po
			local hitPo = raycast.Position
			anim:Play() -- this is where I play the animation
				-- make sure this runs right
				if currentNum + 1 == num then
					currentNum+= 2
					anim:AdjustSpeed(0) -- make the anim freeze

					-- check if there is a humanoid.

					if raycast.Instance.Parent:FindFirstChild('Humanoid') then -- this only runs once.

						local hitChar = raycast.Instance.Parent
						local hitPart = raycast.Instance
						local hitHum = hitChar:FindFirstChild('Humanoid')
						local hitRoot = hitChar.PrimaryPart

						warn('Hit the character, '..hitChar.Name, 'Hit the part, '..hitPart.Name)


			-- just move them to the normal position, or PO2
		-- send a raycast to po2. find where it hits. move them to there
		-- if they hit a player, deal damage and do hit anim for attack.
		--Any questions? 

Does this have to do with where I fire the raycast? Or is there another thing?

I figured it out.
There was some stuff going on with the numbers

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