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