TYSM I WORKED but that problem I had at the start still remains its not detecting the Slope or Angle here’s the script one more time:
Script Here
local function OnHoldingDown(Action)
print(Variables.Sprinting)
if Module.HoldDownEnabled then
if not Variables.Overheated and Variables.ActuallyEquipped and Variables.Enabled and Variables.Sprinting == true then
local Slide = Instance.new("BodyVelocity")
if Action == "Go" and not HoldingDownCooldown then
Character.Humanoid.WalkSpeed = 0
ReplicatedStorage.Modules.ViewmodelHandler.Sliding.Value = true
HoldingDownCooldown = true
Variables.HoldDown = true
--if Animations.HoldDownAnim then
-- Animations.HoldDownAnim:Play(nil, nil, Module.HoldDownAnimationSpeed)
--end
--if VMAnimations.VMHoldDownAnim then
-- VMAnimations.VMHoldDownAnim:Play(nil, nil, Module.VMHoldDownAnimationSpeed)
--end
Humanoid.HipHeight = 0.5
Slide.MaxForce = Vector3.new(1,0,1) * 45000
Slide.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 50
Slide.Parent = Character.HumanoidRootPart
GlobalFunctionId = localFunctionId
spawn(function()
while wait(0.1) do
if localFunctionId ~= GlobalFunctionId then
Slide.Velocity = Slide.Velocity * 0
if Slide then
Slide:Destroy()
end
break
end
if Variables.Sprinting == true then
local HumanoidRootPart = Character.PrimaryPart
local HipHeight = Humanoid.HipHeight
local Params = RaycastParams.new()
Params.FilterDescendantsInstances = {Character}
Params.FilterType = Enum.RaycastFilterType.Blacklist
local ray = workspace:Raycast(HumanoidRootPart.Position, Vector3.new(0, -HipHeight - 1, 0), Params)
local normal = ray and ray.Normal
local incline = Vector3.new(1, 0, 0):Cross(Vector3.new(normal))
if incline.magnitude == 0 then
incline = Vector3.new(1, 0, 0)
end
local angle = math.acos(Vector3.new(0, 1, 0):Dot(incline))
if angle > math.pi / 1.5 then
print("Angle")
Slide.Velocity = angle * Slide.Velocity * 1.1
else
print("No Angle")
Slide.Velocity = Slide.Velocity * 0.9
end
else
repeat wait(0.1) until Variables.Sprinting == true
end
end
end)
else
GlobalFunctionId = os.clock()
Character.Humanoid.WalkSpeed = 16
Variables.HoldDown = false
--if Animations.IdleAnim then
-- Animations.IdleAnim:Play(nil, nil, Module.IdleAnimationSpeed)
--end
--if VMAnimations.VMIdleAnim then
-- VMAnimations.VMIdleAnim:Play(nil, nil, Module.VMIdleAnimationSpeed)
--end
--if Animations.HoldDownAnim and Animations.HoldDownAnim.IsPlaying then
-- Animations.HoldDownAnim:Stop()
--end
--if VMAnimations.VMHoldDownAnim and VMAnimations.VMHoldDownAnim.IsPlaying then
-- VMAnimations.VMHoldDownAnim:Stop()
--end
Humanoid.HipHeight = 2
Slide:Destroy()
Character.PrimaryPart.Velocity = Vector3.new(0,0,0)
ReplicatedStorage.Modules.ViewmodelHandler.Sliding.Value = false
wait(0.5)
HoldingDownCooldown = false
end
end
end
end