Sliding system with cooldown (R15)

Hi!
In this topic I will show you how to make sliding system and cooldown for it.

Result:
robloxapp-20220309-1435102.wmv (450.7 KB)

  1. The first thing to do is to create a LocalScript in StarterCharacterScripts.
    1

  2. Then paste this script:

local UIS = game:GetService("UserInputService")
local char = script.Parent
local slideAnim = Instance.new("Animation")

slideAnim.AnimationId = "rbxassetid://YourID"

local keybind = Enum.KeyCode.Q
local canslide = true

UIS.InputBegan:Connect(function(input,gameprocessed)
	if gameprocessed then return end
	if not canslide then return end
	
	if input.KeyCode == keybind then
		canslide = false
		
		local playAnim = char.Humanoid:LoadAnimation(slideAnim)
		playAnim:Play()
		
		local slide = Instance.new("BodyVelocity")
		slide.MaxForce = Vector3.new(1,0,1) * 30000
		slide.Velocity = char.HumanoidRootPart.CFrame.lookVector * 100
		slide.Parent = char.HumanoidRootPart
		
		for count = 1, 8 do
			wait(.1)
			slide.Velocity *= .7
		end
		playAnim:Stop()
		slide:Destroy()
		canslide = false
		
			==
			playAnim:Stop()
		slide:Destroy()
		wait(15)
		canslide = true
	end
end)

Where it says “YourID” you need to insert your animation ID.

slideAnim.AnimationId = “rbxassetid://YourID”

  1. Create a dummy and open the Animation Editor.
    Make a pose and set “Action” in Set Animation Priority.
    2

  2. Next, save the animation and go to our animation page, copy the ID and paste it into the script.

  3. To configure cooldown, we need to change one digit at the end of our script.
    Find the last 4 lines and find wait(15). Change the number to your own and you’re done!

playAnim:Stop()
		slide:Destroy()
		wait(15)
		canslide = true
	end
end)
  1. Here we can change the letter to which the ability will be used.
local keybind = Enum.KeyCode.Q

:wave:

7 Likes

Don’t use wait
Use task.wait(duration=0)

2 Likes

Paste script without any explanation? cool tutor.

It’s like saying paste this virus script.

4 Likes

well I mean its good but there are a few things that i think can get this topic reported

1st: No video showing how it works
2nd: I think commitblue and aridfights have already said that

2 Likes

Use linear velocity not body velocity for new work.

3 Likes