First of all, thanks to those of you that have helped me with issues over the past few days. Even though some of them I figured out myself, I am really grateful for those of you that put forth time and effort into helping me.
My question is pretty straightforward, however I can't seem to figure out a way to code it successfully.
The code I have set up for damage in
local Damage = 25
local humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid:TakeDamage(Damage)
end
However, I'm also trying to include a temporary "slowdown" effect on hit, such as removing 2 from the humanoid's current walkspeed for 0.2 seconds, then allowing them to resume walking at their previous walkspeed.
The issue I'm having is that when I place a wait after slowing the walkspeed, it factors into the actual weapon's firing rate, essentially slowing the entire shooting process down. |