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
)
local uis = game:GetService("UserInputService") local player = game.Players.LocalPlayer local character = player.Character local humanoid = character:WaitForChild('Humanoid') uis.InputBegan:Connect(function(keyCode) if keyCode.keyCode == Enum.KeyCode.LeftControl or keyCode.keyCode == Enum.KeyCode.RightControl then humanoid.WalkToPoint = humanoid.WalkToPoint * Vector3.new(0,-10,0) for i = humanoid.WalkSpeed,0,0.5 do humanoid.WalkSpeed = i wait() end end end) uis.InputBegan:Connect(function(keyCode) if keyCode.keyCode == Enum.KeyCode.LeftControl or keyCode.keyCode == Enum.KeyCode.RightControl then humanoid.WalkSpeed = 12 end end)
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!
Your method works, but the player can easily interrupt the slide because your way of doing it uses the .WalkToPoint property of the player's humanoid, but I think BodyVelocities can be of use here, or maybe TweenService if you're that lazy.