It’s basically the old Velocity property, relabled to fit the naming terminology of the new assembly style of handling part physics. Functionally it’s a Vector3 that shows you the current part speed along each axis. I’m not sure if this behavior still works, but traditionally you could use it on anchored parts to create conveyor belts.
This look’s very good! But i’m found a glitch when you try to jump on a small object, you are teleported from that object. So i’m think i’m edited script and this glitch removed.
local character = script.Parent --character, can grab from CharacterAdded signal / or placing script under character in StarterCharacter
local humanoid = character:WaitForChild("Humanoid")
local primaryPart = character:WaitForChild("HumanoidRootPart")
humanoid.StateChanged:Connect(function(oldState, newState)
if newState == Enum.HumanoidStateType.Landed then
-- cancel out existing velocity
local velo = primaryPart.AssemblyLinearVelocity
primaryPart.AssemblyLinearVelocity = velo*Vector3.new(1,0,1)
-- get distance to ground
local ray = Ray.new(primaryPart.Position, Vector3.new(0,-20,0))
local hit, pos = game.Workspace:FindPartOnRay(ray, character)
--apply ground hit position to character at hip height offset
local hipHeight = humanoid.HipHeight
local newPos = pos + Vector3.new(0,hipHeight,0)
character:MoveTo(primaryPart.Position - primaryPart.Position + newPos) -- changed to moveTo and instead of primaryPart.CFrame used primaryPart.Position
end
end)
If you found a glitch please tell me. I’m try fix it
4 Likes
local character = script.Parent --character, can grab from CharacterAdded signal / or placing script under character in StarterCharacter
local humanoid = character:WaitForChild("Humanoid")
local primaryPart = character:WaitForChild("HumanoidRootPart")
humanoid.StateChanged:Connect(function(oldState, newState)
if newState.Name == "Landed" then
-- cancel out existing velocity
local velo = primaryPart.AssemblyLinearVelocity
primaryPart.AssemblyLinearVelocity = velo*Vector3.new(1,0,1)
-- get distance to ground
local ray = Ray.new(primaryPart.Position, Vector3.new(0,-20,0))
local hit, pos = game.Workspace:FindPartOnRay(ray, character)
--apply ground hit position to character at hip height offset
local hipHeight = humanoid.HipHeight
local newPos = pos + Vector3.new(0,hipHeight,0)
character:SetPrimaryPartCFrame(primaryPart.CFrame - primaryPart.Position + newPos)
end
end)
here ya go
2 Likes
Somebody posted this exact same script a year ago LMAO
oh damn, didnt even see it. Well I had it on hand so use it if u want