local Block = script.Parent
local TweenService = game:GetService("TweenService")
local function characterFall(character)
local humanoid = character:FindFirstChild("Humanoid")
if not humanoid then
return
end
humanoid.PlatformStand = true
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if not humanoidRootPart then
return
end
local fallAngle = CFrame.Angles(math.pi/2, 0, 0)
local fallTweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local fallTween = TweenService:Create(humanoidRootPart, fallTweenInfo, {CFrame = humanoidRootPart.CFrame * fallAngle})
fallTween:Play()
fallTween.Completed:Wait()
wait(2)
humanoid.PlatformStand = false
end
local function onClick(player)
local character = player.Character
if character then
characterFall(character)
end
end
-- ClickDetector Setup
local clickDetector = Instance.new("ClickDetector", Block)
clickDetector.MaxActivationDistance = 6
clickDetector.MouseClick:Connect(onClick)
local Block = script.Parent
local TweenService = game:GetService("TweenService")
local function characterFall(character)
local humanoid = character:FindFirstChild("Humanoid")
if not humanoid then
return
end
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if not humanoidRootPart then
return
end
local fallAngle = CFrame.Angles(0, 0, math.pi)
local function animateLimb(limbName, targetAngle)
local limb = character:FindFirstChild(limbName)
if not limb then
return
end
local limbTweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local limbTween = TweenService:Create(limb, limbTweenInfo, {CFrame = limb.CFrame * targetAngle})
limbTween:Play()
return limbTween
end
local tweens = {}
for _, twoAngles in ipairs({
{"Left arm", CFrame.Angles(0, math.pi/4, 0)},
{"Right arm", CFrame.Angles(0, -math.pi/4, 0)},
{"Left leg", CFrame.Angles(-math.pi/4, 0, 0)},
{"Right leg", CFrame.Angles(-math.pi/4, 0, 0)}
}) do
local limb, targetAngle = unpack(twoAngles)
local tween = animateLimb(limb, targetAngle)
if tween then
table.insert(tweens, tween)
end
end
for _, tween in ipairs(tweens) do
tween.Completed:Wait()
end
wait(2)
end
local function onClick(player)
local character = player.Character
if character then
characterFall(character)
end
end
-- ClickDetector Setup
local clickDetector = Instance.new("ClickDetector", Block)
clickDetector.MaxActivationDistance = 6
clickDetector.MouseClick:Connect(onClick)
With this code, when a Robloxian clicks the block, their arms and legs will animate during the fall, resulting in a more natural-looking stumble before they fall flat.