What's new
Heapleak - Scripthub

Get the most out of HeapLeak by creating a free account! Once signed in, you’ll gain full access to restricted content, be able to share your own scripts, and participate in our member-only discussions.

laydown script by me😋

Version / Update: v1.0.0
Download / Script Link
--!!!!!!!!!!!!!!!!!!!!press L to laydown

-- 本地脚本,放在StarterPlayerScripts中
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local rootPart = character:WaitForChild("HumanoidRootPart")

local isLying = false
local originalCFrame -- 存储原始位置和旋转
local originalStateSettings = {} -- 存储原始状态设置

-- 躺下函数
local function lieDown()
if isLying then return end
isLying = true

-- 保存原始状态
originalCFrame = rootPart.CFrame
-- 保存原始状态设置,用于后续恢复
originalStateSettings.GettingUp = humanoid:GetStateEnabled(Enum.HumanoidStateType.GettingUp)
originalStateSettings.Physics = humanoid:GetStateEnabled(Enum.HumanoidStateType.Physics)

-- 禁用移动和自动状态恢复
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
humanoid.AutoRotate = false -- 禁用自动旋转
-- 关键:禁用"起身"和"物理"状态,防止Humanoid自动纠正姿势
humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
humanoid:SetStateEnabled(Enum.HumanoidStateType.Physics, false)

-- 让角色平躺(旋转90度并稍微下沉)
rootPart.CFrame = originalCFrame *
CFrame.Angles(math.rad(90), 0, 0) * -- 旋转90度平躺
CFrame.new(0, -1, 0) -- 稍微下沉贴近地面
end

-- 站起来函数
local function standUp()
if not isLying then return end
isLying = false

-- 恢复原始状态
rootPart.CFrame = originalCFrame

-- 恢复移动能力和状态设置
humanoid.WalkSpeed = 16
humanoid.JumpPower = 50
humanoid.AutoRotate = true
-- 恢复原始状态设置
humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, originalStateSettings.GettingUp)
humanoid:SetStateEnabled(Enum.HumanoidStateType.Physics, originalStateSettings.Physics)
end

-- 按L键切换躺/站状态
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if not gameProcessed and input.KeyCode == Enum.KeyCode.L then
if isLying then
standUp()
else
lieDown()
end
end
end)

-- 角色重生时重置
player.CharacterAdded:Connect(function(newCharacter)
character = newCharacter
humanoid = character:WaitForChild("Humanoid")
rootPart = character:WaitForChild("HumanoidRootPart")
isLying = false
originalStateSettings = {}
end)
warn("script execute😍")
[ View More ]
3dc63f7c-1594-443e-b729-1367c3212234.webp


!!!!!!!!!!!!!!!!!!!!press L to laydownno ui eacan use in every game
 
Back
Top