Certainly! To make altplayer5's HumanoidRootPart (HRP) match the specified player's HRP with the requested rotation and offset — instead of manipulating altplayer5's head — you'll want to update altplayer5's HumanoidRootPart's CFrame rather than its head's.
Here's the updated relevant part inside the main loop:
Replace this part:
local altHead5 = altChar5 and altChar5:FindFirstChild("Head")
with:
local altHRP5 = altChar5 and altChar5:FindFirstChild("HumanoidRootPart")
And replace the line that sets altplayer5's head CFrame:
local rotatedCFrame = specifiedRoot.CFrame * alt5Rotation
local pos = rotatedCFrame.Position
local newPos = Vector3.new(pos.X, pos.Y - 3, pos.Z)
altHead5.CFrame = CFrame.new(newPos) * CFrame.fromMatrix(Vector3.new(), rotatedCFrame.RightVector, rotatedCFrame.UpVector, rotatedCFrame.LookVector)
with this to set the HumanoidRootPart CFrame instead:
local rotatedCFrame = specifiedRoot.CFrame * alt5Rotation
local pos = rotatedCFrame.Position
local newPos = Vector3.new(pos.X, pos.Y - 3, pos.Z)
altHRP5.CFrame = CFrame.new(newPos) * CFrame.fromMatrix(Vector3.new(), rotatedCFrame.RightVector, rotatedCFrame.UpVector, rotatedCFrame.LookVector)
Full updated script snippet for altplayer5:
local altHRP5 = altChar5 and altChar5:FindFirstChild("HumanoidRootPart")
-- ...
if leftLeg and rightLeg and specifiedRoot and altHead1 and altHead2 and altHead3 and altHead4 and altHRP5 then
-- altplayer1-4 as before...
-- altplayer5 HRP: rotated HumanoidRootPart, 3 studs down world Y
local rotatedCFrame = specifiedRoot.CFrame * alt5Rotation
local pos = rotatedCFrame.Position
local newPos = Vector3.new(pos.X, pos.Y - 3, pos.Z)
altHRP5.CFrame = CFrame.new(newPos) * CFrame.fromMatrix(Vector3.new(), rotatedCFrame.RightVector, rotatedCFrame.UpVector, rotatedCFrame.LookVector)
end
Full final script with this applied:
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
-- Replace these with your actual player names
local specifiedPlayerName = "SpecifiedPlayer"
local altPlayer1Name = "altplayer1"
local altPlayer2Name = "altplayer2"
local altPlayer3Name = "altplayer3"
local altPlayer4Name = "altplayer4"
local altPlayer5Name = "altplayer5"
local function waitForCharacter(player)
while not player.Character or not player.Character:FindFirstChild("HumanoidRootPart") do
player.CharacterAdded:Wait()
end
return player.Character
end
local specifiedPlayer = Players:WaitForChild(specifiedPlayerName)
local altPlayer1 = Players:WaitForChild(altPlayer1Name)
local altPlayer2 = Players:WaitForChild(altPlayer2Name)
local altPlayer3 = Players:WaitForChild(altPlayer3Name)
local altPlayer4 = Players:WaitForChild(altPlayer4Name)
local altPlayer5 = Players:WaitForChild(altPlayer5Name)
local specifiedCharacter = waitForCharacter(specifiedPlayer)
local altChar1 = waitForCharacter(altPlayer1)
local altChar2 = waitForCharacter(altPlayer2)
local altChar3 = waitForCharacter(altPlayer3)
local altChar4 = waitForCharacter(altPlayer4)
local altChar5 = waitForCharacter(altPlayer5)
-- Function to set HipHeight and WalkSpeed
local function setSpecifiedPlayerStats(character)
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.HipHeight = 10
humanoid.WalkSpeed = 32
else
warn("Humanoid not found in specified player's character.")
end
end
-- Apply initially
setSpecifiedPlayerStats(specifiedCharacter)
-- Update on respawn
specifiedPlayer.CharacterAdded:Connect(function(char)
waitForCharacter(specifiedPlayer) -- wait for HumanoidRootPart again
setSpecifiedPlayerStats(char)
end)
local function getLeftLeg(character)
local part = character:FindFirstChild("Left Leg") or character:FindFirstChild("LeftLowerLeg") or character:FindFirstChild("LeftUpperLeg")
return part
end
local function getRightLeg(character)
local part = character:FindFirstChild("Right Leg") or character:FindFirstChild("RightLowerLeg") or character:FindFirstChild("RightUpperLeg")
return part
end
-- Offsets
local downOffset = Vector3.new(0, -1, 0)
local leftOffset = Vector3.new(-2, 0, 0)
local rightOffset = Vector3.new(2, 0, 0)
local furtherDownOffset = Vector3.new(0, -5, 0)
-- Rotation for altplayer5: pitch 90°, roll 90°
local pitchRad = math.rad(90)
local rollRad = math.rad(90)
local alt5Rotation = CFrame.Angles(pitchRad, 0, rollRad)
RunService.Heartbeat:Connect(function()
if specifiedPlayer.Character and altPlayer1.Character and altPlayer2.Character
and altPlayer3.Character and altPlayer4.Character and altPlayer5.Character then
-- Refresh parts in case of respawn
local specifiedCharacter = specifiedPlayer.Character
local altChar1 = altPlayer1.Character
local altChar2 = altPlayer2.Character
local altChar3 = altPlayer3.Character
local altChar4 = altPlayer4.Character
local altChar5 = altPlayer5.Character
local leftLeg = getLeftLeg(specifiedCharacter)
local rightLeg = getRightLeg(specifiedCharacter)
local specifiedRoot = specifiedCharacter:FindFirstChild("HumanoidRootPart")
local altHead1 = altChar1 and altChar1:FindFirstChild("Head")
local altHead2 = altChar2 and altChar2:FindFirstChild("Head")
local altHead3 = altChar3 and altChar3:FindFirstChild("Head")
local altHead4 = altChar4 and altChar4:FindFirstChild("Head")
local altHRP5 = altChar5 and altChar5:FindFirstChild("HumanoidRootPart")
if leftLeg and rightLeg and specifiedRoot and altHead1 and altHead2 and altHead3 and altHead4 and altHRP5 then
-- altplayer1 head: left leg + 1 stud down + 2 studs left
altHead1.CFrame = leftLeg.CFrame * CFrame.new(leftOffset) * CFrame.new(downOffset)
-- altplayer2 head: right leg + 1 stud down + 2 studs right
altHead2.CFrame = rightLeg.CFrame * CFrame.new(rightOffset) * CFrame.new(downOffset)
-- altplayer3 head: altplayer1 head + 5 studs down
altHead3.CFrame = altHead1.CFrame * CFrame.new(furtherDownOffset)
-- altplayer4 head: altplayer2 head + 5 studs down
altHead4.CFrame = altHead2.CFrame * CFrame.new(furtherDownOffset)
-- altplayer5 HRP: rotated HumanoidRootPart, 3 studs down world Y
local rotatedCFrame = specifiedRoot.CFrame * alt5Rotation
local pos = rotatedCFrame.Position
local newPos = Vector3.new(pos.X, pos.Y - 3, pos.Z)
altHRP5.CFrame = CFrame.new(newPos) * CFrame.fromMatrix(Vector3.new(), rotatedCFrame.RightVector, rotatedCFrame.UpVector, rotatedCFrame.LookVector)
end
end
end)
Summary:
- Now the script updates
altplayer5's HumanoidRootPart CFrame instead of the head's.
- The HRP is rotated and positioned with the specified pitch and roll, offset 3 studs down relative to world Y axis.
- Other alt players' heads are updated as you requested before.
Let me know if you want me to help with any other adjustments!