can you generate me a lua script that will make altplayer1 match position and rotation of specifiedplayer while being 4 studs more down and also there will be altplayer2 that will do the same as altplayer1 but he will be 5 studs more left and theres gonna be altplayer3 that will do the same as altplayer1 but he will be 5 studs more right and altplayer1,2,3 will be rotated 90 left horizontally and not vertically
Assistant
User
can instead of primarypart it will be torso?
Assistant
User
why altplayer1,2,3 arent being rotated 90 degrees down?
Assistant
Great question!
From your description, "rotated 90 left horizontally and NOT vertically", I interpreted the rotation as a yaw rotation of -90 degrees (i.e., turning left on the horizontal plane), not pitching them down (which would be a rotation around the X-axis).
If you want them to be rotated 90 degrees down instead (i.e., pitch down by 90 degrees, which means looking straight down), then the rotation needs to be applied around the X-axis, not the Y-axis.
User
can you update whole script
Assistant
User
and also how to make altplayer1,2,3 rotated 90 left horizontally this time
Assistant
User
can you provide me the full script
Assistant
User
do altplayer1,2,3 also getting rotated 90 degrees down?
Assistant
No — in the provided script, altplayer1, altplayer2, and altplayer3 are rotated only 90 degrees left horizontally, meaning they are yaw-rotated by -90 degrees around the Y-axis, not rotated 90 degrees down (which would be a pitch rotation around the X-axis).
Quick recap:
The script uses this rotation for alt players:
local rotationOffset = CFrame.Angles(0, -math.rad(90), 0)
This means:
Rotation around Y-axis by -90 degrees → turn left horizontally.
No rotation around X-axis → no looking up/down (pitch).
No rotation around Z-axis → no roll.
If you want altplayer1,2,3 to be rotated 90 degrees down (look straight down), you would change the rotationOffset to pitch 90 degrees around X:
local rotationOffset = CFrame.Angles(math.rad(90), 0, 0)
Or for both rotated 90 degrees down and 90 degrees left horizontally, combine both rotations:
local rotationOffset = CFrame.Angles(math.rad(90), -math.rad(90), 0)
User
can u provide script whit pitch and yaw ?
Assistant
Certainly! Here's a Lua script for Roblox that will make altplayer1, altplayer2, and altplayer3 match the position and rotation of a specifiedplayer with the described offsets and rotations. The alt players will be:
altplayer1: 4 studs down (negative Y)
altplayer2: same as altplayer1 + 5 studs left (negative X)
altplayer3: same as altplayer1 + 5 studs right (positive X)
All alt players will be rotated 90 degrees left horizontally (yaw -90 degrees), without pitch or roll changes.
local Players = game:GetService("Players")
-- Set these to the actual player objects
local specifiedPlayer = Players:FindFirstChild("specifiedplayer")
local altplayer1 = Players:FindFirstChild("altplayer1")
local altplayer2 = Players:FindFirstChild("altplayer2")
local altplayer3 = Players:FindFirstChild("altplayer3")
if not (specifiedPlayer and altplayer1 and altplayer2 and altplayer3) then
warn("One or more players not found!")
return
end
-- Helper function to get character's PrimaryPart CFrame safely
local function getCharacterCFrame(player)
if player.Character and player.Character.PrimaryPart then
return player.Character.PrimaryPart.CFrame
end
return nil
end
-- Rotate 90 degrees left around Y axis
local rotationOffset = CFrame.Angles(0, -math.rad(90), 0)
-- Update function
local function updateAlts()
local baseCFrame = getCharacterCFrame(specifiedPlayer)
if not baseCFrame then
warn("Specified player character or PrimaryPart not found")
return
end
-- Base position with 4 studs down
local downOffset = Vector3.new(0, -4, 0)
local basePos = baseCFrame.Position + downOffset
-- Calculate rotated CFrame:
-- Start with specified player's orientation, apply the rotation offset
local baseRotation = baseCFrame - baseCFrame.Position -- rotation component only
-- altplayer1 position and rotation
local alt1_CFrame = CFrame.new(basePos) * baseRotation * rotationOffset
-- altplayer2: 5 studs left (relative to alt1). "Left" is negative X axis in local space.
-- We'll move left relative to alt1's orientation
local leftOffset = alt1_CFrame.RightVector * -5 -- Left is -RightVector
local alt2_CFrame = alt1_CFrame + leftOffset
-- altplayer3: 5 studs right (relative to alt1)
local rightOffset = alt1_CFrame.RightVector * 5
local alt3_CFrame = alt1_CFrame + rightOffset
-- Apply to alt players
if altplayer1.Character and altplayer1.Character.PrimaryPart then
altplayer1.Character.PrimaryPart.CFrame = alt1_CFrame
end
if altplayer2.Character and altplayer2.Character.PrimaryPart then
altplayer2.Character.PrimaryPart.CFrame = alt2_CFrame
end
if altplayer3.Character and altplayer3.Character.PrimaryPart then
altplayer3.Character.PrimaryPart.CFrame = alt3_CFrame
end
end
-- Run every frame to follow specifiedPlayer smoothly
game:GetService("RunService").Heartbeat:Connect(updateAlts)
Explanation:
The script assumes all players (specifiedplayer, altplayer1, altplayer2, altplayer3) have their characters loaded with PrimaryParts set.
It takes the specified player's CFrame position and rotation.
Moves all alt players 4 studs down in world Y.
Applies a rotation of 90 degrees left (yaw -90).
Moves altplayer2 5 studs left relative to altplayer1's orientation, altplayer3 5 studs right.
Updates positions every frame.
Make sure the alt players exist and their characters are loaded before this runs, or you can put checks and delays as appropriate in your use case. If you'd like me to adapt this script for any specifics or add additional error checking, just ask!
Sure! If you want to use the Torso part instead of PrimaryPart, the script just needs to access the Torso part directly from each character.
Here is the modified version of the script that uses the Torso part for positioning and rotation:
local Players = game:GetService("Players")
-- Set these to the actual player objects
local specifiedPlayer = Players:FindFirstChild("specifiedplayer")
local altplayer1 = Players:FindFirstChild("altplayer1")
local altplayer2 = Players:FindFirstChild("altplayer2")
local altplayer3 = Players:FindFirstChild("altplayer3")
if not (specifiedPlayer and altplayer1 and altplayer2 and altplayer3) then
warn("One or more players not found!")
return
end
-- Helper function to get character's Torso CFrame safely
local function getTorsoCFrame(player)
local character = player.Character
if character then
local torso = character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")
if torso then
return torso.CFrame
end
end
return nil
end
-- Rotate 90 degrees left around Y axis
local rotationOffset = CFrame.Angles(0, -math.rad(90), 0)
-- Update function
local function updateAlts()
local baseCFrame = getTorsoCFrame(specifiedPlayer)
if not baseCFrame then
warn("Specified player torso not found")
return
end
-- Base position with 4 studs down
local downOffset = Vector3.new(0, -4, 0)
local basePos = baseCFrame.Position + downOffset
-- Calculate rotated CFrame:
-- Start with specified player's orientation, apply the rotation offset
local baseRotation = baseCFrame - baseCFrame.Position -- rotation component only
-- altplayer1 position and rotation
local alt1_CFrame = CFrame.new(basePos) * baseRotation * rotationOffset
-- altplayer2: 5 studs left (relative to alt1). Left is negative RightVector
local leftOffset = alt1_CFrame.RightVector * -5
local alt2_CFrame = alt1_CFrame + leftOffset
-- altplayer3: 5 studs right (relative to alt1)
local rightOffset = alt1_CFrame.RightVector * 5
local alt3_CFrame = alt1_CFrame + rightOffset
-- Apply to alt players' torso
local function setTorsoCFrame(player, cframe)
if player.Character then
local torso = player.Character:FindFirstChild("Torso") or player.Character:FindFirstChild("UpperTorso")
if torso then
torso.CFrame = cframe
end
end
end
setTorsoCFrame(altplayer1, alt1_CFrame)
setTorsoCFrame(altplayer2, alt2_CFrame)
setTorsoCFrame(altplayer3, alt3_CFrame)
end
-- Run every frame to follow specifiedPlayer smoothly
game:GetService("RunService").Heartbeat:Connect(updateAlts)
Notes:
The script works for both R6 and R15 rigs by checking for "Torso" (R6) or "UpperTorso" (R15).
It sets the CFrame of the torso directly.
If your avatars don't have either part named "Torso" or "UpperTorso" for some reason, you might need to change the part name accordingly.
When setting CFrame of torso directly, make sure it’s safe and doesn’t conflict with constraints or animations that might reset position.
Let me know if you want me to add support for waiting for characters to load, or anything else!
But if you want both — e.g., yaw left 90° AND pitch down 90°, then combine:
local rotationOffset = CFrame.Angles(math.rad(90), -math.rad(90), 0)
Summary:
Rotation around X axis = pitch (up/down)
Rotation around Y axis = yaw (left/right)
Rotation around Z axis = roll (tilt sideways)
Example fully updated snippet for 90° down (pitch) only:
local rotationOffset = CFrame.Angles(math.rad(90), 0, 0)
Replace the old rotationOffset declaration with the above and the alt players will be rotated 90° down instead of left.
If the players still don't appear rotated as expected, be sure:
Their torso's CFrame is free to be changed.
There are no conflicting animations forcing orientation.
The rotation is relative to the original orientation, which the script already handles.
Let me know if you want me to update the whole script with the new rotation!
Certainly! Here's the full updated script that makes altplayer1, altplayer2, and altplayer3 match the specifiedplayer's torso position and rotation, apply these offsets:
altplayer1 is 4 studs down.
altplayer2 is 4 studs down and 5 studs left relative to altplayer1.
altplayer3 is 4 studs down and 5 studs right relative to altplayer1.
All alt players are rotated 90 degrees down (pitched downward), not yawed left.
local Players = game:GetService("Players")
-- Player names (adjust as needed)
local specifiedPlayer = Players:FindFirstChild("specifiedplayer")
local altplayer1 = Players:FindFirstChild("altplayer1")
local altplayer2 = Players:FindFirstChild("altplayer2")
local altplayer3 = Players:FindFirstChild("altplayer3")
if not (specifiedPlayer and altplayer1 and altplayer2 and altplayer3) then
warn("One or more players not found!")
return
end
-- Helper function: get CFrame of torso or upper torso safely
local function getTorsoCFrame(player)
local character = player.Character
if character then
return (character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")) and ((character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")).CFrame)
end
return nil
end
-- Rotation offset: rotate 90 degrees down (pitch)
local rotationOffset = CFrame.Angles(math.rad(90), 0, 0)
local RunService = game:GetService("RunService")
-- Update function to set alt players positions and rotations
local function updateAlts()
local baseCFrame = getTorsoCFrame(specifiedPlayer)
if not baseCFrame then
warn("Specified player torso not found")
return
end
-- Base position 4 studs down relative to world Y
local downOffset = Vector3.new(0, -4, 0)
local basePos = baseCFrame.Position + downOffset
-- Extract rotation portion of baseCFrame
local baseRotation = baseCFrame - baseCFrame.Position
-- altplayer1: basePos + rotation + rotationOffset
local alt1_CFrame = CFrame.new(basePos) * baseRotation * rotationOffset
-- altplayer2: 5 studs left relative to altplayer1 (negative RightVector)
local leftOffset = alt1_CFrame.RightVector * -5
local alt2_CFrame = alt1_CFrame + leftOffset
-- altplayer3: 5 studs right relative to altplayer1
local rightOffset = alt1_CFrame.RightVector * 5
local alt3_CFrame = alt1_CFrame + rightOffset
local function setTorsoCFrame(player, cframe)
if player.Character then
local torso = player.Character:FindFirstChild("Torso") or player.Character:FindFirstChild("UpperTorso")
if torso then
torso.CFrame = cframe
end
end
end
setTorsoCFrame(altplayer1, alt1_CFrame)
setTorsoCFrame(altplayer2, alt2_CFrame)
setTorsoCFrame(altplayer3, alt3_CFrame)
end
RunService.Heartbeat:Connect(updateAlts)
How it works:
It grabs the torso CFrame of the specified player.
Slides 4 studs down on world Y.
Applies the torso's original orientation.
Then applies a 90-degree pitch downward.
Moves altplayer2 and altplayer3 left/right relative to altplayer1.
Sets the CFrame of alt players' torso parts accordingly.
Runs the update every frame for smooth tracking.
If you want yaw rotation or any combination, just let me know!
To rotate the altplayers 90 degrees left horizontally (i.e., yaw rotation of -90 degrees around the Y axis), you need to set the rotationOffset to rotate around the Y axis like this:
local rotationOffset = CFrame.Angles(0, -math.rad(90), 0)
Here’s your updated full script with 90 degrees left horizontal rotation (yaw):
local Players = game:GetService("Players")
-- Player names (adjust as needed)
local specifiedPlayer = Players:FindFirstChild("specifiedplayer")
local altplayer1 = Players:FindFirstChild("altplayer1")
local altplayer2 = Players:FindFirstChild("altplayer2")
local altplayer3 = Players:FindFirstChild("altplayer3")
if not (specifiedPlayer and altplayer1 and altplayer2 and altplayer3) then
warn("One or more players not found!")
return
end
-- Helper to get torso or upper torso CFrame safely
local function getTorsoCFrame(player)
local character = player.Character
if character then
return (character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")) and ((character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")).CFrame)
end
return nil
end
-- Rotation offset: 90 degrees left horizontally (yaw)
local rotationOffset = CFrame.Angles(0, -math.rad(90), 0)
local RunService = game:GetService("RunService")
local function updateAlts()
local baseCFrame = getTorsoCFrame(specifiedPlayer)
if not baseCFrame then
warn("Specified player torso not found")
return
end
-- Move 4 studs down on world Y axis
local downOffset = Vector3.new(0, -4, 0)
local basePos = baseCFrame.Position + downOffset
-- Extract rotation part of baseCFrame
local baseRotation = baseCFrame - baseCFrame.Position
-- altplayer1: basePos + rotation + rotationOffset
local alt1_CFrame = CFrame.new(basePos) * baseRotation * rotationOffset
-- altplayer2: 5 studs left relative to altplayer1
local leftOffset = alt1_CFrame.RightVector * -5
local alt2_CFrame = alt1_CFrame + leftOffset
-- altplayer3: 5 studs right relative to altplayer1
local rightOffset = alt1_CFrame.RightVector * 5
local alt3_CFrame = alt1_CFrame + rightOffset
local function setTorsoCFrame(player, cframe)
if player.Character then
local torso = player.Character:FindFirstChild("Torso") or player.Character:FindFirstChild("UpperTorso")
if torso then
torso.CFrame = cframe
end
end
end
setTorsoCFrame(altplayer1, alt1_CFrame)
setTorsoCFrame(altplayer2, alt2_CFrame)
setTorsoCFrame(altplayer3, alt3_CFrame)
end
RunService.Heartbeat:Connect(updateAlts)
Summary:
CFrame.Angles(0, -math.rad(90), 0) rotates 90 degrees left around Y-axis (horizontal rotation).
Use Vector3.new(0, -4, 0) for vertical downward offset.
altplayer2 and altplayer3 offset relative to altplayer1's left/right direction.
Feel free to run this, and ask if you want yaw+pitch combined or any other custom rotations!
Certainly! Here's the full script that:
Makes altplayer1, altplayer2, and altplayer3 follow specifiedplayer's torso position,
Offsets them 4 studs down,
Offsets altplayer2 5 studs left of altplayer1,
Offsets altplayer3 5 studs right of altplayer1,
Rotates all alt players 90 degrees left horizontally (yaw -90°),
Uses "Torso" or "UpperTorso" parts instead of PrimaryPart.
local Players = game:GetService("Players")
-- Change these to your actual player names
local specifiedPlayer = Players:FindFirstChild("specifiedplayer")
local altplayer1 = Players:FindFirstChild("altplayer1")
local altplayer2 = Players:FindFirstChild("altplayer2")
local altplayer3 = Players:FindFirstChild("altplayer3")
if not (specifiedPlayer and altplayer1 and altplayer2 and altplayer3) then
warn("One or more players not found!")
return
end
-- Helper function to get torso or upper torso CFrame safely
local function getTorsoCFrame(player)
local character = player.Character
if character then
local torso = character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")
if torso then
return torso.CFrame
end
end
return nil
end
-- Rotation offset: 90 degrees left horizontally (rotate around Y axis by -90 degrees)
local rotationOffset = CFrame.Angles(0, -math.rad(90), 0)
local RunService = game:GetService("RunService")
local function updateAlts()
local baseCFrame = getTorsoCFrame(specifiedPlayer)
if not baseCFrame then
warn("Specified player torso not found")
return
end
-- Move 4 studs down in world space (negative Y)
local downOffset = Vector3.new(0, -4, 0)
local basePos = baseCFrame.Position + downOffset
-- Extract rotation component of specified player’s torso CFrame
local baseRotation = baseCFrame - baseCFrame.Position
-- altplayer1 CFrame: base position + base rotation + rotation offset (90° left)
local alt1_CFrame = CFrame.new(basePos) * baseRotation * rotationOffset
-- altplayer2 offset: 5 studs left relative to altplayer1
local leftOffset = alt1_CFrame.RightVector * -5
local alt2_CFrame = alt1_CFrame + leftOffset
-- altplayer3 offset: 5 studs right relative to altplayer1
local rightOffset = alt1_CFrame.RightVector * 5
local alt3_CFrame = alt1_CFrame + rightOffset
-- Helper function to set torso CFrame for alt players
local function setTorsoCFrame(player, cframe)
if player.Character then
local torso = player.Character:FindFirstChild("Torso") or player.Character:FindFirstChild("UpperTorso")
if torso then
torso.CFrame = cframe
end
end
end
setTorsoCFrame(altplayer1, alt1_CFrame)
setTorsoCFrame(altplayer2, alt2_CFrame)
setTorsoCFrame(altplayer3, alt3_CFrame)
end
-- Connect the update function to RunService.Heartbeat to update every frame
RunService.Heartbeat:Connect(updateAlts)
How to use:
Replace "specifiedplayer", "altplayer1", "altplayer2", and "altplayer3" with the actual player names in your game.
Place this script in a server script or somewhere it can control these players.
Make sure each player’s character loads and includes either a Torso (R6) or UpperTorso (R15) part.
If you want me to add any features or fail-safe checks, just ask!
Let me know if you want me to generate a full updated script with pitch down, yaw left, or both combined!
Certainly! Below is the full script where altplayer1, altplayer2, and altplayer3:
Follow specifiedplayer's torso position,
Are offset 4 studs down,
altplayer2 is 5 studs left of altplayer1,
altplayer3 is 5 studs right of altplayer1,
And are rotated both 90 degrees down (pitch) and 90 degrees left (yaw).
local Players = game:GetService("Players")
-- Change these names to your actual player names
local specifiedPlayer = Players:FindFirstChild("specifiedplayer")
local altplayer1 = Players:FindFirstChild("altplayer1")
local altplayer2 = Players:FindFirstChild("altplayer2")
local altplayer3 = Players:FindFirstChild("altplayer3")
if not (specifiedPlayer and altplayer1 and altplayer2 and altplayer3) then
warn("One or more players not found!")
return
end
-- Helper function to get torso or upper torso CFrame safely
local function getTorsoCFrame(player)
local character = player.Character
if character then
local torso = character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")
if torso then
return torso.CFrame
end
end
return nil
end
-- Rotation offset: 90 degrees pitch down (X), and 90 degrees yaw left (Y)
local rotationOffset = CFrame.Angles(math.rad(90), -math.rad(90), 0)
local RunService = game:GetService("RunService")
local function updateAlts()
local baseCFrame = getTorsoCFrame(specifiedPlayer)
if not baseCFrame then
warn("Specified player torso not found")
return
end
-- Move 4 studs down in world space (negative Y)
local downOffset = Vector3.new(0, -4, 0)
local basePos = baseCFrame.Position + downOffset
-- Extract rotation component of specified player’s torso CFrame
local baseRotation = baseCFrame - baseCFrame.Position
-- altplayer1 CFrame: base position + base rotation + combined rotation offset
local alt1_CFrame = CFrame.new(basePos) * baseRotation * rotationOffset
-- altplayer2 offset: 5 studs left relative to altplayer1
local leftOffset = alt1_CFrame.RightVector * -5
local alt2_CFrame = alt1_CFrame + leftOffset
-- altplayer3 offset: 5 studs right relative to altplayer1
local rightOffset = alt1_CFrame.RightVector * 5
local alt3_CFrame = alt1_CFrame + rightOffset
-- Helper function to set torso CFrame for alt players
local function setTorsoCFrame(player, cframe)
if player.Character then
local torso = player.Character:FindFirstChild("Torso") or player.Character:FindFirstChild("UpperTorso")
if torso then
torso.CFrame = cframe
end
end
end
setTorsoCFrame(altplayer1, alt1_CFrame)
setTorsoCFrame(altplayer2, alt2_CFrame)
setTorsoCFrame(altplayer3, alt3_CFrame)
end
-- Update every frame
RunService.Heartbeat:Connect(updateAlts)
Explanation:
CFrame.Angles(math.rad(90), -math.rad(90), 0) rotates first 90 degrees down (pitch around X-axis), then 90 degrees left (yaw around Y-axis).
The script applies the rotation offset after copying the specified player’s base rotation.
The altplayers' torso positions are updated each frame with the offsets you requested.
Position offsets are in world coordinates for the vertical drop and relative coordinates (left/right) for the sideways offsets.