local RunService = game:GetService("RunService") local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Root = Character:WaitForChild("HumanoidRootPart") local Humanoid = Character:WaitForChild("Humanoid") -- Settings local RAY_LENGTH = 3.5 -- How far down to look for a player local BOUNCE_FORCE = 5 -- Small upward force to stay on top RunService.Heartbeat:Connect(function() -- Only run if we are actually in the air/falling if Humanoid:GetState() == Enum.HumanoidStateType.Freefall or Humanoid:GetState() == Enum.HumanoidStateType.Jumping then -- Setup Raycast local raycastParams = RaycastParams.new() raycastParams.FilterDescendantsInstances = {Character} raycastParams.FilterType = Enum.RaycastFilterType.Exclude -- Cast downwards local raycastResult = workspace:Raycast(Root.Position, Vector3.new(0, -RAY_LENGTH, 0), raycastParams) if raycastResult and raycastResult.Instance then local hitModel = raycastResult.Instance:FindFirstAncestorOfClass("Model") -- Check if the hit object is a player if hitModel and hitModel:FindFirstChild("Humanoid") then -- Stop falling through them by resetting Y velocity Root.AssemblyLinearVelocity = Vector3.new(Root.AssemblyLinearVelocity.X, BOUNCE_FORCE, Root.AssemblyLinearVelocity.Z) -- Optional: Change state to Landed to allow another jump immediately Humanoid:ChangeState(Enum.HumanoidStateType.Landed) end end end end)