Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you make a BodyVelocity fling someone upwards?

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

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.