Hi,
I’m working on a game that utilizes slides as a important mechanic. I want it so that the player can slide under 1-2 stud gaps smoothly without any problem. Problem is mine can only go under 2.5 studs and sometimes it has problems with 2.5. How do I fix this without changing the slide animation?
2 Stud Gap (gets stuck)
Slide:
local function handleAction(actionName, inputState, _inputObject)
local Humanoid = Character:FindFirstChild("Humanoid") :: Humanoid
if actionName == ACTION_SLIDE and inputState == Enum.UserInputState.Begin then
if isSlide then
return
end
if Player.Team ~= Settings.Green then
return
end
Character.Humanoid.JumpHeight = 0
isSlide = true
local animator = Humanoid:FindFirstChildWhichIsA("Animator")
local playAnim = animator:LoadAnimation(Animations.Slide)
playAnim:Play()
local slide = Instance.new("BodyVelocity")
slide.MaxForce = Vector3.new(1,0,1) * 15000
slide.Velocity = Character.HumanoidRootPart.CFrame.LookVector * 100
slide.Parent = Character.HumanoidRootPart
task.spawn(function()
PlaySound(Background.Slide, Character.HumanoidRootPart, false)
for count = 1, 8 do
task.wait(.1)
slide.Velocity *= .6
end
Character.Humanoid.JumpHeight = 5
task.wait(0.3)
playAnim:Stop()
slide:Destroy()
task.wait(1.5)
isSlide = false
end)
end
if actionName == ACTION_SPRINT and inputState == Enum.UserInputState.Begin then
if Humanoid.WalkSpeed == StarterPlayer.CharacterWalkSpeed then
Humanoid.WalkSpeed = Settings.Sprint
return
end
if Humanoid.WalkSpeed ~= StarterPlayer.CharacterWalkSpeed then
Humanoid.WalkSpeed = StarterPlayer.CharacterWalkSpeed
return
end
end
end