Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can i make status effects like stun?

2 answers

✓ Accepted answer

Hello, eze123456!

I'm providing you a script because... you deserve it.

--LocalScript
-- Place it in the starterpack.

player = game.Players.LocalPlayer -- First, we get the LocalPlayer

used = false

anim = script.Animation -- Note : You have to make an animation inside roblox's Animation Plugin, then you have to create an Animation Object inside this script (not plugin),
--MAKE SURE to get the Id.

hum = player.Character.Humanoid

animTrack = hum:LoadAnimation(anim) 

player.Character.Humanoid.HealthChanged:Connect(function() -- This, is a Function, it only works when the player's health changes!
     if player.Character.Humanoid.Health <= player.Character.Humanoid.MaxHealth and  used == false then -- Detects if the health is lower than MaxHealth!

animTrack:Play() -- Play animation.
hum.WalkSpeed = hum.WalkSpeed - 16 -- Makes the player unable to walk.
---player.Character.Humanoid.PlatformStand = true -- Causes a Stun-Like effect, note : remove the ( --- ) to use!
wait(2) -- Waits for nearly 2 seconds.
---player.Character.Humanoid.PlatformStand = false 
hum.WalkSpeed = hum.WalkSpeed + 16 -- Makes the player able to walk.
animTrack:Stop() -- Stop animation.

used = true
wait(3)
used = false

end -- end!
end) -- end function.

-- Have fun!

2 comments

0

thanks but how could i add a stunned animation though?

0

Edited my answer, accept it so we both get reputation.

Yes its possible

there's is many ways you can do it!

you could insert a Bool Value inside your character and make it false and name it "StunValue"

then you could add a script to make it if the bool value changed to true then it will set your walkspeed to 0 or enable platform stand like unsatisfied_d said.

This discussion is preserved as it was. New answers, comments, and votes are closed.