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

How do you make a BodyVelocity fling someone upwards?

Asked by
Kurcha 33
5 years ago
Edited 5 years ago
local function jump(player)
    local root = player.Character.HumanoidRootPart
    local BodyVelocity = Instance.new("BodyVelocity")
    BodyVelocity.Parent = root
    BodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
    BodyVelocity.P = 50
    player.Character.HumanoidRootPart.Velocity = Vector3.new(0,100,0)
    local dir = CFrame.Angles(math.pi*2,0,0)
    local spd = 350
    root.BodyVelocity.velocity = ((root.CFrame * dir).lookVector) * spd
    wait(.1)
    BodyVelocity:Destroy()
end

My script ties to a RemoteFunction. I need to know how to make a this go up. I attempted to make it go up by creating a Velocity but that didn't work. Is there anyone who knows how to do this?

1 answer

Log in to vote
0
Answered by
DanzLua 2879 Moderation Voter Community Moderator
5 years ago

Simply add a vector3 to the vector3 you are setting the bodyvelocity's velocity to

local function jump(player)
    local root = player.Character.HumanoidRootPart
    local BodyVelocity = Instance.new("BodyVelocity")
    BodyVelocity.Parent = root
    BodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
    BodyVelocity.P = 50
    player.Character.HumanoidRootPart.Velocity = Vector3.new(0,100,0)
    local dir = CFrame.Angles(math.pi*2,0,0)
    local spd = 350
    root.BodyVelocity.velocity = (((root.CFrame * dir).lookVector) * spd) + Vector3.new(0,100,0)
    wait(.1)
    BodyVelocity:Destroy()
end
Ad

Answer this question