You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want to make a slide script based on LinearVelocity. I want to maintain the same slide velocity independently of the direction I’m looking at on the y axis.
-
What is the issue? Whenever I slide, the slide velocity is affected by the camera’s cframe. However, when I look up or down the velocity of the slide is reduced due to the x and z angular coordinates being lowered.
-
What solutions have you tried so far? I thought about multiplying the force by the y coordinate but it wasn’t as simple as I thought.
The code is down here.
local function slide()
if debounce == false then
canLoseSpeed = false
local walkspeed = humanoid.WalkSpeed
local slideForce = Instance.new("LinearVelocity", hrp)
slideForce.Attachment0 = att0
slideForce.MaxForce = math.huge
local x,y,z = camera.CFrame:ToOrientation()
local slideVector = CFrame.fromOrientation(x,y,z)
slideForce.VectorVelocity = Vector3.new(slideVector.LookVector.X,0,slideVector.LookVector.Z) * walkspeed * 1.4
local slidegoal = {}
slidegoal.VectorVelocity = slideForce.VectorVelocity * 0.5
local slidetween = TweenInfo.new(1,Enum.EasingStyle.Exponential,Enum.EasingDirection.In)
local slidingtween = tweenService:Create(slideForce,slidetween,slidegoal)
slidingtween:Play()
debounce = true
wait(1.4)
slideForce:Destroy()
canLoseSpeed = true
debounce = false
end
end
Thanks for all the help