I've been trying to implement this slide mechanic. For some reason, the animation & velocity doesn't stop.
local player = game:GetService("Players").LocalPlayer local char = player.Character or player.CharacterAdded:Wait() -- Index the current character, or grab the one from CharacterAdded when that event fires. local InputService = game:GetService("UserInputService") local animation = Instance.new("Animation") local slidepossible = true animation.AnimationId = "rbxassetid://9168644824" wait(0.25) -- waiting for stuff to load local playAnim = char.Humanoid:LoadAnimation(animation) local slide = Instance.new("BodyVelocity") InputService.InputBegan:Connect(function(key,gameprocessed) if gameprocessed then return end if not slidepossible then return end if key.KeyCode == Enum.KeyCode.LeftControl then if not _G.running then slidepossible = false local playAnim = char.Humanoid:LoadAnimation(animation) 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(0.1) slide.Velocity *=0.7 end end end end) InputService.InputEnded:Connect(function(key,gameprocessed) if gameprocessed then return end if key.KeyCode == Enum.KeyCode.LeftControl or Enum.KeyCode.Right then playAnim:Stop() wait() slide:Destroy("BodyVelocity") canslide = true end
There are no errors and no output whatsoever. https://streamable.com/16okxg