Is it possible to create a function that stuns the player when they take damage?
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!
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.