I don’t see anything wrong at all, but it doesn’t work at all. Could you please check the script.
Handtile.hand.ChildRemoved:Connect(function(child)
if child:IsA("Part") or child:IsA("MeshPart") then
-- 랜덤한 수의 Arm 생성
local armCount = math.random(1, 5)
local selectedArmIndex = math.random(1, armCount) -- 여러 Arm 중 하나를 선택
for i = 1, armCount do
-- Arm 복사 및 GiantArm 설정
local newArm = ArmModel:Clone()
local positionPart = newArm:WaitForChild("PositionPart")
newArm.Parent = Handtile
-- GiantArm 파트 찾기
local giantArm = newArm:FindFirstChild("GiantArm")
if not giantArm or not giantArm:IsA("BasePart") then
warn("GiantArm 파트를 찾을 수 없습니다.")
return
end
-- Handtile 중심 위치 계산 (X, Z에 랜덤 값 추가)
local randomOffsetX = math.random(-10, 10)
local randomOffsetZ = math.random(-10, 10)
local centerPosition = Handtile.Middle.CFrame.Position + Vector3.new(randomOffsetX, 0, randomOffsetZ)
-- 각도 랜덤 값 계산
local randomRotationX = math.rad(math.random(-20, 20))
local randomRotationY = math.rad(math.random(45, 270))
local randomRotationZ = math.rad(math.random(-20, 20))
-- CFrame 생성 (회전 포함)
local centerCFrame = CFrame.new(centerPosition) * CFrame.Angles(randomRotationX, randomRotationY, randomRotationZ)
newArm:SetPrimaryPartCFrame(centerCFrame)
-- 선택된 Arm에 AlignPosition 추가
if i == selectedArmIndex then
local closestPlayer = findClosestPlayer(centerPosition)
if closestPlayer then
local character = closestPlayer.Character
if character and character:FindFirstChild("HumanoidRootPart") then
-- Attachments 생성 및 설정
local positionAttachment = Instance.new("Attachment")
positionAttachment.Parent = positionPart
local humanoidAttachment = Instance.new("Attachment")
humanoidAttachment.Parent = character.HumanoidRootPart
-- AlignPosition 생성 및 설정
local alignPosition = Instance.new("AlignPosition")
alignPosition.Attachment0 = positionAttachment
alignPosition.Attachment1 = humanoidAttachment
alignPosition.Visible = true
alignPosition.RigidityEnabled = true
alignPosition.MaxForce = math.huge
alignPosition.Responsiveness = 200
alignPosition.ApplyAtCenterOfMass = false
alignPosition.Parent = character.HumanoidRootPart
-- 사로잡힌 플레이어를 표시
print(closestPlayer.Name .. "가 사로잡혔습니다! (Arm " .. i .. ")")
end
end
wait(0.2)
script.Parent.Middle["Rock Impact 2 (SFX)"]:Play()
end
-- Animator 및 애니메이션 실행
local animator = newArm:FindFirstChild("AnimationController")
if animator then
local animationTrack = animator:LoadAnimation(handanimation)
animationTrack:Play()
end
-- TweenService로 Y축 이동
local armSizeY = giantArm.Size.Y
local targetPosition = centerPosition + Vector3.new(0, armSizeY / 2.5, 0)
local downTargetPosition = centerPosition - Vector3.new(0, armSizeY / 2, 0)
local tweenInfo = TweenInfo.new(
1,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out
)
local tween = TweenService:Create(
giantArm,
tweenInfo,
{Position = targetPosition}
)
local downTween = TweenService:Create(
giantArm,
tweenInfo,
{Position = downTargetPosition}
)
tween:Play()
tween.Completed:Connect(function()
wait(2)
if i == armCount then
script.Parent.Middle["Rocks Movement 1 (SFX)"]:Play()
end
downTween:Play()
end)
end
end
end)
The “AlignPosition” we use here connects the PositionPart and the Humanoid RootPart in the “Arm”. If you have any more questions, please ask.
I’d really appreciate it if you could help me.