of     1   

222304
Top 100 Poster
#183634596Monday, February 15, 2016 2:00 AM GMT

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.
ray_revenge
#183634831Monday, February 15, 2016 2:03 AM GMT

coroutine.wrap(function() humanoid.WalkSpeed = humanoid.WalkSpeed - 2 wait(.2) humanoid.WalkSpeed = humanoid.WalkSpeed + 2 end)()
cntkillme
#183634882Monday, February 15, 2016 2:04 AM GMT

The simplest way would be to do something like: humanoid.WalkSpeed = 14; Delay(0.2, function() humanoid.WalkSpeed = 16; end); It's not great, a better way would be to affect the wait time for the firing rate, add a wait(0.2), reset the WalkSpeed, then wait(firingrate - 0.2)
SwagCuzYolo
#183635137Monday, February 15, 2016 2:07 AM GMT

coroutine
ray_revenge
#183635192Monday, February 15, 2016 2:08 AM GMT

@cnt I would assume that his guns wait a shorter time than .2 seconds
222304
Top 100 Poster
#183642272Monday, February 15, 2016 3:42 AM GMT

Thanks guys! I didn't even know about coroutine.wrap until now.

    of     1