[SOLVED BY ME] Is my attempt at making a slide script good?
Asked by
5 years ago Edited 5 years ago
This question has been solved by the original poster.
So I was creating a parkour game, and I was working on a mechanic in which where a player presses Ctrl
and the player would 'slide' on the surface while playing the animation.
Here's my attempt at doing so. (LocalScript
inside of PlayerGui
)
01 | local uis = game:GetService( "UserInputService" ) |
02 | local player = game.Players.LocalPlayer |
03 | local character = player.Character |
04 | local humanoid = character:WaitForChild( 'Humanoid' ) |
05 | uis.InputBegan:Connect( function (keyCode) |
06 | if keyCode.keyCode = = Enum.KeyCode.LeftControl or keyCode.keyCode = = Enum.KeyCode.RightControl then |
07 | humanoid.WalkToPoint = humanoid.WalkToPoint * Vector 3. new( 0 ,- 10 , 0 ) |
08 | for i = humanoid.WalkSpeed, 0 , 0.5 do |
09 | humanoid.WalkSpeed = i |
14 | uis.InputBegan:Connect( function (keyCode) |
15 | if keyCode.keyCode = = Enum.KeyCode.LeftControl or keyCode.keyCode = = Enum.KeyCode.RightControl then |
16 | humanoid.WalkSpeed = 12 |
The thing is, it works and all, but the speed isn't slowing down...
Can someone at least give me an idea on how I could make/polish this script?
DISCLAIMER: No, I am NOT looking for scripts. I want to see if there's a property that uses some sort of Velocity or something.
EDIT: So I actually found a property inside of a humanoid called PlatformStand
. It ragdolls the Character
but it gets up pretty good and smooth, unlike Humanoid.Sit
. I just slapped in a quick sliding animation and voila! I fixed it in one fell swoop. Thank you for reading this post!