I have a script and i want to be able to get a parts height then translate it into the assemblylinearvelocity that is needed to get up that part.
hopefully i explained this okay.
local prompt = false
local RunningPlayers = {}
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local humanoid = char:WaitForChild("Humanoid")
humanoid.Running:Connect(function(speed)
if speed > 0 then -- Ensure the player is actually running
if RunningPlayers[plr.UserId] then return end
RunningPlayers[plr.UserId] = true
local humRoot = char:WaitForChild("HumanoidRootPart")
local module = require(script.Parent.ParkourCheck)
local value, face = module.CheckPart(game.Workspace.Part, humRoot)
task.wait(1)
if value == true then
plr.PlayerGui.ClimbPrompt.Enabled = true
end
if value == true and RunningPlayers[plr.UserId] == true then
prompt = true
print("Player is in the area")
plr.PlayerGui.ClimbPrompt.Enabled = true
humRoot.AssemblyLinearVelocity = Vector3.new(0,?,0)
else
prompt = false
print("Player is not in the area")
print(face)
plr.PlayerGui.ClimbPrompt.Enabled = false
end
-- Reset debounce after the logic completes
RunningPlayers[plr.UserId] = false
end
end)
end)
end)
You can get the minimum y-val for the AssemblyLinearVelocity by getting the y-value of the part’s size, which can be smth like Size : 8,1,2. But you prob need to add the AssemblyMass of the character too since the character has mass.
In Summary:
The AssemblyLinearVelocity of the HumanoidRootPart needed can be attained by adding the part’s size’s Y-Value, the AssemblyMass of the entire character and some small change.
First we need to know some equations for projectile motion:
Vertical position by time → 0.5gt² + v't
Vertical speed by time → v'+ gt
First, we need to know at what time does a projectile reach the apex of it’s motion. Or in other words, when our speed equation equals zero: v' + gt = 0 which solves to t = -v'/g
Next, we solve for the height of the motion, because we just solved what time we reach the apex of our jump we can plug that into our position equation: H = 0.5g(-v'/g)² + v'(-v'/g) which solves to H = 0.5v'²/g
Lastly we can rearrange the formula to solve for the initial velocity! v'² = 2Hg → v' = sqrt(2Hg)
Hopefully I explained it well, I just summarized this article which you can check out for a more in-depth answer if you’d like!