Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i make status effects like stun?

Asked by 5 years ago

Is it possible to create a function that stuns the player when they take damage?

0
yes its possible green271 635 — 5y
0
yes, just set their walkspeed to 0 or near 0 theking48989987 2147 — 5y
0
Or enable PlatformStand in Humanoid's properties hellmatic 1523 — 5y

2 answers

Log in to vote
0
Answered by
AIphanium 124
5 years ago
Edited 5 years ago

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!
0
thanks but how could i add a stunned animation though? EzireBlueFlame 14 — 5y
0
Edited my answer, accept it so we both get reputation. AIphanium 124 — 5y
Ad
Log in to vote
1
Answered by
Tizzel40 243 Moderation Voter
5 years ago
Edited 5 years ago

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.

Answer this question