Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a set speed for a body velocity?

Asked by 5 years ago
wait(2)

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local p = player.Character.HumanoidRootPart.CFrame

local BV = Instance.new("BodyVelocity")
BV.Name = "Mover"
BV.Parent = player.Character.HumanoidRootPart
BV.MaxForce = Vector3.new(math.huge, math.huge, math.huge)

mouse.Button1Down:Connect(function()
    Active = true
    while Active == true do
        wait()
        print(mouse.Hit.Position)
        BV.Velocity = mouse.Hit.Position * p.lookVector --Faulty
    end
end)

mouse.Button1Up:Connect(function()
    Active = false
end)


At the line where it says "faulty" doesn't work as it is supposed to. I want to set the speed to a certain speed despite anywhere you click. any fixes?

Answer this question