Hey there, I want to have a Sliding Ability in my game and it doesn’t seem to be working.
The thing is when i test it doesn’t work and the Output has no Errors
The Script: In StarterCharacterScripts and the Animation is inside the script
In Game:
Output:
I looked for some solutions but they don’t seem to help, so i came here to see if anyone knew.
The Script’s Code:
local UserInputService = game:GetService("UserInputService")
local Character = script.Parent
local SlideAnimation = script:WaitForChild("SlideAnimation")
local CanSlide = true
UserInputService.InputBegan:Connect(function(Input,GameProcessed)
if not GameProcessed then return end
if Input == Enum.KeyCode.LeftControl then
if CanSlide == true then
CanSlide = false
local PlayAnimation = Character.Humanoid.Animator:LoadAnimation(SlideAnimation)
PlayAnimation:Play()
local Slide = Instance.new("BodyVelocity")
Slide.MaxForce = Vector3.new(1,0,1) * 30000
Slide.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 100
Slide.Parent = Character.HumanoidRootPart
CanSlide = false
wait(.8)
PlayAnimation:Stop()
Slide:Destroy()
wait(4.2)
CanSlide = true
end
end
end)