Enemy Rush Attack

Hey there, I am asking for advice on if there would be a better way to accomplish such a task. My current one is changing the speed but sometimes depending on how far he goes he just goes right through the wall. Here is what the script for my charge attack looks like:

local function charge(nearestTarget, distance, direction)
	if not attacks.charge:FindFirstChild("Cooldown") and ghostHumanoid.Data.terrifying.Value == false then
		local chargeAnim = ghostHumanoid.Animator:LoadAnimation(animations.charge)
		humanoidRootPart.SFX.Attacks.charge_Attack:Play()
		chargeAnim:Play()
		humanoidRootPart.CanCollide = false
		ghostHumanoid.WalkSpeed = 25
		charging = true
		wait(3)
		humanoidRootPart.CanCollide = true
		ghostHumanoid.WalkSpeed = 16
		local cooldown = createCooldown(attacks.charge)
		debris:AddItem(cooldown, attacks.charge.cooldownTime.Value)
		chargeAnim:Stop()
	end
end

Many thanks in advance!

1 Like

don’t turn off its CanCollide then?

2 Likes

I don’t know how I looked over that, I’ve read it so many times! lol.

Appreciate you for pointing that out, completely forgot I even had that.

1 Like

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