local Players = game:GetService("Players") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local disabled = {} local floorY = nil local floor = Instance.new("Part") floor.Size = Vector3.new(10, 1, 10) floor.Anchored = true floor.CanQuery = false floor.CanTouch = false floor.Transparency = 1 floor.Parent = workspace.CurrentCamera local params = RaycastParams.new() params.RespectCanCollide = true local function check(part) if not part:IsA("BasePart") or not floorY then return end local cf, size = part.CFrame, part.Size local halfHeight = math.abs(cf.RightVector.Y) * size.X / 2 + math.abs(cf.UpVector.Y) * size.Y / 2 + math.abs(cf.LookVector.Y) * size.Z / 2 if cf.Position.Y + halfHeight > floorY + 1.5 then if part.CanCollide then disabled[part] = true part.CanCollide = false end elseif disabled[part] then disabled[part] = nil part.CanCollide = true end end local function scan() for _, name in ipairs({ "ActiveMaps", "Lobby" }) do local root = workspace:FindFirstChild(name) if root then for _, part in ipairs(root:GetDescendants()) do check(part) end end end end local elapsed = 3 RunService.Heartbeat:Connect(function(dt) local char = player.Character local root = char and char:FindFirstChild("HumanoidRootPart") local humanoid = char and char:FindFirstChildOfClass("Humanoid") if not (root and humanoid) then return end local height = humanoid.HipHeight + root.Size.Y / 2 params.FilterDescendantsInstances = { char, workspace.CurrentCamera } local hit = workspace:Raycast(root.Position, Vector3.new(0, -(height + 30), 0), params) floorY = hit and hit.Position.Y or floorY or root.Position.Y - height floor.CFrame = CFrame.new(root.Position.X, floorY - 0.5, root.Position.Z) elapsed = elapsed + dt if elapsed >= 3 then elapsed = 0 scan() end end)