Trying to consistently launch players, giving them the same landing zone regardless of mass.
I launched a player who started with about 14 mass, then deleted a few limbs, and launched them again with 9 mass, and they didn’t get even close to where the first one did. I’m obviously doing this math incorrectly, any suggestions?
local canLaunch = true
local character = {}
function character:GetMass()
local mass = 0
for _,v in pairs(game.Players.LocalPlayer.Character:GetDescendants()) do
if ((v:IsA("BasePart") or v:IsA("MeshPart")) and not v.Massless) then
mass = mass + v:GetMass()
end
end
return mass
end
local launchers = game.Workspace.Launchers:GetChildren()
for iteration, launcher in ipairs(launchers) do
local launchPart = launcher.LaunchPart
launchPart.Touched:Connect(function(part)
if part.Parent == game.Players.LocalPlayer.Character and canLaunch then
canLaunch = false
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.Parent = game.Players.LocalPlayer.Character.HumanoidRootPart
local characterMass =character:GetMass()
print(characterMass)
BodyVelocity.Velocity = launchPart.CFrame.LookVector * (16.85 * characterMass)
BodyVelocity.MaxForce = Vector3.new(99999999,99999999,99999999)
wait(.3)
BodyVelocity:Destroy()
canLaunch = true
end
end)
end