I have a slide mechanic in my game, which itself works just fine but the animation for it doesn’t play outside of studio for some reason.
It’s in StartetCharacterScripts:
local UiS = game:GetService(“UserInputService”)
local Char = script.Parent
local humanoid = script.Parent:WaitForChild(“Humanoid”)
local slideAnim = Instance.new(“Animation”)
slideAnim.AnimationId = “rbxassetid://13641472825”
local keybind = Enum.KeyCode.E
local canslide = true
UiS.InputBegan:Connect(function(input, gameprocessed)
if gameprocessed then return end
if not canslide then return end
if input.KeyCode == keybind and humanoid:GetState() ~= Enum.HumanoidStateType.Freefall then
canslide = false
local playAnim = Char.Humanoid:LoadAnimation(slideAnim)
playAnim:Play()
humanoid.HipHeight = 0.2
local slide = Instance.new("BodyVelocity")
slide.MaxForce = Vector3.new(1,0,1) * 30000
slide.Velocity = Char.HumanoidRootPart.CFrame.lookVector * 100
slide.Parent = Char.HumanoidRootPart
Char.Humanoid.MaxSlopeAngle = 1
for count = 1,8 do
wait(0.1)
slide.Velocity *= 1
end
Char.Humanoid.MaxSlopeAngle = 89
playAnim:Stop()
humanoid.HipHeight = 2.3
slide:Destroy()
wait(.7)
canslide = true
end
end)