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

[SOLVED BY ME] Is my attempt at making a slide script good?

Asked by 4 years ago
Edited 4 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)

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!

0
I'm Also Making A Parkour Game.. Can You Give Me The Animation Pls? User#34743 0 — 4y
0
@Next_Memer No sorry... Sensei_Developer 298 — 4y
0
Uhh I think its wrong. Maybe try it on a script D1amondySword 0 — 4y
0
do you mind if i take this? i only makes games for fun and not for profit S_mphy 0 — 3y
0
how do i implement an animation, i dont need an animation im just wondering S_mphy 0 — 3y

1 answer

Log in to vote
0
Answered by 4 years ago

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.

0
Yeah this is really old my friend. This was like, last year or something. Sensei_Developer 298 — 4y
Ad

Answer this question