can you generate me a script that there will be 1specifiedplayer and altplayer1 and…
- User
can you generate me a script that there will be 1specifiedplayer and altplayer1 and altplayer1 will match position and rotation of 1specifiedplayer but will be 3 more studs up in lua
- Assistant
Certainly! Below is a simple Lua script for Roblox that makes
altplayer1match the position and rotation of1specifiedplayer, but positioned 3 studs higher on the Y-axis.Assuming both players have characters and their HumanoidRootParts are used for positioning and rotation:
-- Replace these with your actual player references local Players = game:GetService("Players") local specifiedPlayer = Players:FindFirstChild("1specifiedplayer") -- the original player local altPlayer1 = Players:FindFirstChild("altplayer1") -- the alt player -- Function to update altplayer1's position and rotation local function updateAltPlayer() if specifiedPlayer and specifiedPlayer.Character and altPlayer1 and altPlayer1.Character then local specifiedHRP = specifiedPlayer.Character:FindFirstChild("HumanoidRootPart") local altHRP = altPlayer1.Character:FindFirstChild("HumanoidRootPart") if specifiedHRP and altHRP then -- Get the position and rotation of specifiedPlayer local pos = specifiedHRP.CFrame.Position local rot = specifiedHRP.CFrame - specifiedHRP.CFrame.Position -- rotation component -- Set altplayer1 position 3 studs higher on Y-axis, with same rotation altHRP.CFrame = CFrame.new(pos + Vector3.new(0, 3, 0)) * rot end end end -- Update every frame (or use a RunService event) local RunService = game:GetService("RunService") RunService.Heartbeat:Connect(updateAltPlayer) - User
nevermind can u remove all rotation associated things?
- Assistant
Certainly! Here is the simplified script that makes
altplayer1match only the position of1specifiedplayerbut 3 studs higher, without copying any rotation:local Players = game:GetService("Players") local specifiedPlayer = Players:FindFirstChild("1specifiedplayer") local altPlayer1 = Players:FindFirstChild("altplayer1") local RunService = game:GetService("RunService") local function updateAltPlayer() if specifiedPlayer and specifiedPlayer.Character and altPlayer1 and altPlayer1.Character then local specifiedHRP = specifiedPlayer.Character:FindFirstChild("HumanoidRootPart") local altHRP = altPlayer1.Character:FindFirstChild("HumanoidRootPart") if specifiedHRP and altHRP then -- Position exactly like specifiedPlayer but +3 studs on Y axis; no rotation copied local newPos = specifiedHRP.Position + Vector3.new(0, 3, 0) altHRP.CFrame = CFrame.new(newPos) end end end RunService.Heartbeat:Connect(updateAltPlayer)This sets
altplayer1's HumanoidRootPart position to be exactly the specified player's position plus 3 studs up, aligned with the world axes (no rotation is applied). - User
also can u add altplayer2 and his head will match position and rotation of altplayer1 head but also altplayer2 will be rotated 90 degrees up
- Assistant
- User
and can u add altplayer3 and he will do the same as altplayer2 BUT will be rotated negative 90 degrees?
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.