Hey Developers,
can anyone help me with this script? It basically just gives a player a slide ability by pressing a button. The animation is working fine, i only want to change the Body Velocity to a Vector Force since Body Velocities are deprecated…
I want to achieve:
- change the body velocity to a vector force
- keep the slide power as same as before
SlideButton.MouseButton1Down:Connect(function()
if Sliding then return end
Sliding = true
SlideAnimationPlay:Play() -- animation
Slide:Play() -- tween for camera offset
local slide = Instance.new("BodyVelocity")
slide.MaxForce = Vector3.new(1,0,1) * 30000
slide.Velocity = HumanoidRootPart.CFrame.lookVector * 100
slide.Parent = HumanoidRootPart
for count = 1, 8 do
wait(0.1)
slide.Velocity*= 0.7
end
SlideAnimationPlay:Stop()
Idle:Play() -- original camera offset position
slide:Destroy()
Sliding = false
end)
Thanks for any tips! (I also named the Instances, so you know whats getting changed here)