I’ve tried Humanoid.Jump
. to see if the player was jumping, but i couldn’t find a way. heres the code
local UIS = game:GetService(‘UserInputService’)
local char = script.Parent
local CurrentCamera = workspace.CurrentCamera
local hum = char:WaitForChild(“Humanoid”)
local slideAnim = Instance.new(‘Animation’)
slideAnim.AnimationId = ‘rbxassetid://9982077290’
local sound = game.StarterPlayer.StarterCharacterScripts.Slide2.Slide
local slide = Instance.new(“BodyVelocity”)
local keybind = Enum.KeyCode.C
local canslide = true
local playAnim = char.Humanoid:LoadAnimation(slideAnim)
local party = script:WaitForChild(“ParticleEmitter”):Clone()
UIS.InputBegan:Connect(function(input,gameprocessed)
if gameprocessed then return end
if not canslide then return end
if input.KeyCode == keybind then
canslide = false
playAnim:Play(0.15)
sound:Play()
party.Parent = char:WaitForChild("Torso") -- if you have r15 change to UpperTorso
party.Enabled = true
char.HumanoidRootPart.CanCollide = false
CurrentCamera.CameraSubject = char:FindFirstChild('Head')
local Head = char:FindFirstChild('Head')
Head.CanCollide = false
if char.Humanoid:GetState(Enum.HumanoidStateType.Jumping) or (Enum.HumanoidStateType.Freefall) then
local canslide = false
end
slide.Parent = char.Humanoid.RootPart
slide.MaxForce = Vector3.new(1 * 10000,0,1 * 10000)
slide.Velocity = char.HumanoidRootPart.CFrame.lookVector * 80
Head.CanCollide = false
end
end)
UIS.InputEnded:Connect(function(input,gameprocessed)
if gameprocessed then return end
if input.KeyCode == keybind then
for count = 1, 2 do
wait(0.01)
slide.Velocity *= 0.3
end
playAnim:Stop(0.4)
party.Enabled = false
sound:Stop()
slide.Parent = workspace
slide.MaxForce = Vector3.new(0,0,0)
canslide = true
char.HumanoidRootPart.CanCollide = true
CurrentCamera.CameraSubject = char.Humanoid
local Head = char:FindFirstChild(‘Head’)
Head.CanCollide = true
end
end)