Very unusual bug in code after roblox update, any help is very much appreciated!

I’ve run into a very unusual bug after the most recent roblox update, basically this code is a function for a charge attack that an npc uses. Everything was working completely fine until I opened up studio this morning, the issue is that changing the humanoids WalkSpeed through the delay function causes the animation to completely freeze in place while the rest of the code runs. It doesn’t matter what I change the WalkSpeed to as long as it is in the delay function as shown below it will completely freeze the animation. Does anyone know what I can do to work around this issue?

(Removing the walkspeed change in the delay function causes the code to run completely fine without any animation freezing but I need the npc to stop in place, and yes the animations priority is action)

any help would be very much appreciated thank you!

local function chargee()
	charge:Play()
	humanoid.WalkSpeed = 50
	
	canDamage = true
	
	
	delay(0.5, function()
		humanoid.WalkSpeed = 0
		events.CameraShake:FireAllClients("HeavyShake")
		slamSound()
	end)
	
	delay(0.2, function()
		
		for i, v in pairs(blade:GetDescendants()) do
			if v:IsA("ParticleEmitter") then
				v.Enabled = true
			end
		end
		
		wait(0.8)
		
		for i, v in pairs(blade:GetDescendants()) do
			if v:IsA("ParticleEmitter") then
				v.Enabled = false
			end
		end
		
		canDamage = false
	end)
	
	charge.Stopped:Wait()
	
	humanoid.WalkSpeed = 11
end
1 Like