which services, globals etc are server sided if being fired from a signle client in…
- User
which services, globals etc are server sided if being fired from a signle client in roblox?
- Assistant
In Roblox, certain services, globals, and functions are server-sided, meaning they run on the server and are authoritative, even if triggered or fired by a single client. Understanding which parts of Roblox are server-sided vs. client-sided is crucial for ensuring security, consistency, and multiplayer synchronization.
Server-Sided Components When Fired From a Single Client
-
RemoteEvents and RemoteFunctions (when handled on the server)
- When a client fires a
RemoteEventor calls aRemoteFunctionvia a client-to-server communication, the server-side event handlers or callback functions run on the server. - Example:
- Client fires
RemoteEvent:FireServer() - Server listens with
RemoteEvent.OnServerEvent:Connect(function(player, args) ... end)
- Client fires
- This handler runs on the server and can access server-only services and data.
- When a client fires a
-
Services That Run on the Server These services are inherently server-side:
- DataStoreService — For saving/loading player or game data.
- ServerStorage — Storage space inaccessible to clients.
- ServerScriptService — Scripts run server scripts here.
- Workspace (the main 3D game space, but scripts running on the server have authority).
- Players — Access to server-side player instances; clients have limited views.
- Teams
- Chat
- MarketplaceService
- PathfindingService
- PhysicsService
- TeleportService
- InsertService
- MessagingService
- HttpService (when called on the server, can do outbound requests)
- And others that facilitate server-only operations.
-
Globals on the Server
- Variables stored in Script (server script) environments.
- Globals like
game,script,workspace,Playerson the server reflect the server’s view. - Any module scripts required by server scripts run on the server.
-
Scripts
- Script objects (not LocalScripts) run exclusively on the server.
- When a client triggers server-side code through remotes, the server-side Script runs that code.
What Happens When a Client "Fires" Something?
- When a client triggers an action (for example, fires a RemoteEvent or RemoteFunction), only server listeners on that RemoteEvent/Function run on the server.
- The client cannot run or execute server-side code directly; it can only request it.
- The server remains authoritative and the place where data should be validated and game-critical changes happen.
Summary
Component Run Context Fired from client means... RemoteEvent:FireServer()Server (handler) Server event handler runs server-side RemoteFunction:InvokeServer()Server (callback) Server callback runs on server Script (not LocalScript) Server Runs on server only ModuleScripts required by server Server Run on server when required by server scripts DataStoreService, ServerStorage Server Access only on server Workspace (changes by server) Server Server changes replicated to clients LocalScripts Client Do not run server code Game.global variables on server Server Stored and accessed only on the server Important Notes
- The client cannot directly change server-side objects like anything in ServerStorage, ServerScriptService, or secure data. They can only request changes using remotes.
- All authoritative checks, validation, and sensitive operations must happen on the server.
- Server-side code cannot access LocalScript or client-only instances directly; communication always goes via RemoteEvents/RemoteFunctions.
- Services like
RunServicehave both client (Heartbeat,RenderStepped) and server (Stepped) events but run in their respective contexts.
If you'd like a specific example or code demonstrating client-to-server communication and server-side handling, feel free to ask!
-
- User
so creating a new remoteevent in serverscriptservice is serversided?
- Assistant
Yes, creating a new RemoteEvent inside ServerScriptService is server-sided.
Here's a bit more detail:
- ServerScriptService is a container where only server scripts run. Clients cannot access its contents directly.
- Any
Instancecreated inside ServerScriptService is only created on the server and not replicated to clients unless explicitly moved to a replicated container (likeReplicatedStorageorWorkspace). - So, if you do something like this in a server script inside ServerScriptService:
local RemoteEvent = Instance.new("RemoteEvent") RemoteEvent.Name = "MyRemoteEvent" RemoteEvent.Parent = game.ServerScriptService- The RemoteEvent exists only on the server.
- Clients cannot see or access it.
- To allow communication between the server and clients via RemoteEvents, the RemoteEvent must be placed somewhere accessible to both, such as
ReplicatedStorage.
Common Pattern:
- Create RemoteEvents once in a shared location like
ReplicatedStorage(which replicates content both to server and clients). - Server and clients can both access the same RemoteEvent to communicate.
- If placed in ServerScriptService, clients cannot access or fire the RemoteEvent.
Summary:
- Creating a RemoteEvent inside ServerScriptService means the RemoteEvent is purely server-side and not accessible to clients.
- For RemoteEvents that clients fire or listen to, place them in
ReplicatedStorageor a similarly replicated container.
Let me know if you want code examples for setting up RemoteEvents correctly!
- User
so if i create a remoteevent, make a script, and make that script run instance.new() thing but only when remoteevent is fired, will instance.new() be serversided?
- Assistant
Yes!
If you have a RemoteEvent (placed in a location accessible to the client, e.g.,
ReplicatedStorage), and you have a server Script connected to its.OnServerEventthat runsInstance.new()when the RemoteEvent is fired by a client, then the Instance.new() call is running on the server.How it works step-by-step:
- RemoteEvent is placed in
ReplicatedStorage(or some shared location), so both client and server can reference it. - A client fires the RemoteEvent using
RemoteEvent:FireServer(...). - On the server, a Script (not LocalScript) listens to the RemoteEvent with
.OnServerEvent:Connect(function(player, ...) ... end). - Inside this server event handler, if you call
Instance.new(), this creation happens on the server. - If you parent this new instance to a location replicated to clients (like
WorkspaceorReplicatedStorage), clients will see the new instance appear.
Example:
Server Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local remoteEvent = ReplicatedStorage:WaitForChild("MyRemoteEvent") remoteEvent.OnServerEvent:Connect(function(player) local part = Instance.new("Part") part.Size = Vector3.new(4, 1, 2) part.Position = Vector3.new(0, 10, 0) part.Anchored = true part.Parent = workspace -- Parents to workspace (replicated) print("Server created a part on behalf of player: " .. player.Name) end)Client LocalScript:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local remoteEvent = ReplicatedStorage:WaitForChild("MyRemoteEvent") -- When something happens on client, fire server event: remoteEvent:FireServer()Key points:
Instance.new("Part")is happening on the server because it runs inside the.OnServerEventcallback.- You don't want clients creating important instances directly because clients have no authority; they only request the server to do so.
- Parents like
workspaceorReplicatedStorageare replicated from server to clients, so the new part becomes visible to players.
Summary
- Yes,
Instance.new()run inside a server Script (e.g., inside.OnServerEvent) is server-sided. - Clients cannot run server code directly but can request it via RemoteEvents.
- Make sure the creation code is in a server Script (inside ServerScriptService or similar).
If you want a sample or explanation on best practices for this pattern, just let me know!
- RemoteEvent is placed in
- User
can you show me explanation on practice?
- Assistant
Certainly! Here’s a clear explanation of best practices for using RemoteEvents and creating instances server-side in Roblox to ensure security, proper architecture, and smooth client-server communication.
Best Practices for Server-Side Instance Creation Triggered by Clients
The Problem:
You want the client to request the creation of an object (e.g., a Part), but you don't want the client to have direct control over creating or modifying important game objects (for security and consistency reasons). Instead, the server should be the authority that actually creates and manages these instances.
How Roblox's Client-Server Model Works:
-
Client:
- Runs LocalScripts.
- Can listen to or fire RemoteEvents or RemoteFunctions to communicate with the server.
- Cannot create or alter server-only objects directly.
-
Server:
- Runs Scripts inside places like
ServerScriptService. - Owns most game state and data.
- Defines handlers for RemoteEvent or RemoteFunction calls from clients.
- Can safely create and modify instances (
Instance.new()) and replicate them to clients by parenting in places likeWorkspace.
- Runs Scripts inside places like
Step-by-Step Pattern
1. Create a RemoteEvent in ReplicatedStorage
ReplicatedStoragereplicates the object to both client and server:-- (Do this once, e.g., in Studio or in a Server Script on game startup) local ReplicatedStorage = game:GetService("ReplicatedStorage") -- Create the RemoteEvent if it doesn't already exist local remoteEvent = ReplicatedStorage:FindFirstChild("CreatePartEvent") if not remoteEvent then remoteEvent = Instance.new("RemoteEvent") remoteEvent.Name = "CreatePartEvent" remoteEvent.Parent = ReplicatedStorage endYou can also create this RemoteEvent manually in Studio under ReplicatedStorage.
2. Client: Fire the RemoteEvent to request an instance
In a LocalScript (e.g., inside StarterPlayerScripts):
local ReplicatedStorage = game:GetService("ReplicatedStorage") local createPartEvent = ReplicatedStorage:WaitForChild("CreatePartEvent") -- When player wants to create a part, e.g., button press or trigger: createPartEvent:FireServer()
3. Server: Listen for the event and create the object safely
In a server Script inside
ServerScriptService:local ReplicatedStorage = game:GetService("ReplicatedStorage") local createPartEvent = ReplicatedStorage:WaitForChild("CreatePartEvent") createPartEvent.OnServerEvent:Connect(function(player) -- Validate the request! (Example: check if player can create parts) if not player or not player:IsA("Player") then return -- security check end -- Create a new part on behalf of the player local part = Instance.new("Part") part.Size = Vector3.new(4, 1, 2) part.Position = Vector3.new(0, 10, 0) -- You can customize this or base it on player info part.Anchored = true part.BrickColor = BrickColor.Random() part.Name = player.Name .. "'s Part" -- Parent it to Workspace so it replicates to all clients part.Parent = workspace print("Created a part for player: ", player.Name) end)
Why is this best practice?
- Security: The client can only request to create a part, but cannot directly create or manipulate it.
- Authority: The server validates the request and performs the actual creation.
- Consistency: The server controls all important game objects, reducing cheating/hacking.
- Replication: When the server parents the new instance to
workspace, Roblox replicates it back to all clients automatically.
Optional Enhancements:
- Validation — Before creating the object, check conditions (player permissions, cooldowns, limits).
- Arguments — The client can send parameters through
FireServer(...)(e.g., position or color), but always validate on the server. - Clean Up — Optionally tie created instances to the player, and clean them up on player leaving.
- Feedback — Use another RemoteEvent to notify the client about the success/failure of their request.
Summary of the Workflow:
Step Runs on What happens Create RemoteEvent Server / Studio Create event in ReplicatedStorageClient fires RemoteEvent Client Client sends request to server Server handles event Server Server receives request and creates Instance.new() Instance replicated Server → Clients New object appears on all clients
If you want, I can provide a full working example project or discuss how to pass parameters safely!
Feel free to ask questions or request code snippets for any step!
-
- User
can you make this script make altplayer1,2,3 rotate instead of 90 horizontally left they will rotate vertically right local Players = game:GetService("Players")
-- Change these names to your actual player names local specifiedPlayer = Players:FindFirstChild("desktopitemleader") local altplayer1 = Players:FindFirstChild("dekstopminikey") local altplayer2 = Players:FindFirstChild("desktopremotev") local altplayer3 = Players:FindFirstChild("desktopmousec")
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(0), 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)
- Assistant
Sure! To modify your script so that altplayer1,2,3 rotate vertically right instead of rotating 90 degrees horizontally left, we need to adjust the rotation offset accordingly.
What you currently have:
local rotationOffset = CFrame.Angles(math.rad(90), -math.rad(0), 0)This applies a 90-degree pitch rotation (X axis) and no yaw (Y), plus some additional rotation logic.
Your description says "instead of 90 degrees horizontally left" rotate "vertically right".
- Horizontal left 90 degrees means yaw = +90° or -90° on Y axis.
- Vertical right would mean rotating around the Z axis or adjusting pitch and/or yaw to point vertically with a right rotation.
From your script, the altplayers are:
altplayer1's CFrame:basePos + baseRotation * rotationOffsetaltplayer2/altplayer3are offset left and right relative toaltplayer1.
What you want:
- Rotate altplayers vertically right instead of horizontally left.
Adjusting the rotation:
- Vertically points usually involve pitch (X axis rotation).
- Rightward rotation can be interpreted as a +90 degrees roll (Z axis rotation) or a specific combination.
Let's try this rotation offset:
-- Rotate 90 degrees **right vertically**: local rotationOffset = CFrame.Angles(0, 0, math.rad(-90))Explanation:
- Rotation is around the Z axis (roll), negative 90 degrees to rotate right.
- We leave pitch and yaw zero here.
If you want them rotated pointing up (vertical) and turned right, you can do:
local rotationOffset = CFrame.Angles(math.rad(-90), 0, 0) -- Pitch down 90 degrees * CFrame.Angles(0, 0, math.rad(-90)) -- Roll right 90 degreesOr equivalently:
local rotationOffset = CFrame.Angles(math.rad(-90), 0, math.rad(-90))
Applying to your script
Change this line:
-- Rotation offset: 90 degrees pitch down (X), and 90 degrees yaw left (Y) local rotationOffset = CFrame.Angles(math.rad(90), -math.rad(0), 0)to:
-- Rotation offset: rotate vertically right (pitch -90, roll -90) local rotationOffset = CFrame.Angles(math.rad(-90), 0, math.rad(-90))
Full relevant snippet updated:
local rotationOffset = CFrame.Angles(math.rad(-90), 0, math.rad(-90))
Explanation
math.rad(-90)on X axis pitches the torso downwards by 90 degrees (facing down).math.rad(-90)on Z axis rolls the torso right by 90 degrees.- Yaw remains 0, so no turning left or right on Y axis.
Bonus:
If the positioning or offsets seem off after the change, you may need to adjust the left/right offsets accordingly, because the local axes (RightVector, etc.) rotate with the CFrame.
For example, if the horizontal offsets no longer apply as expected, you can replace:
local leftOffset = alt1_CFrame.RightVector * -5 local rightOffset = alt1_CFrame.RightVector * 5with:
local leftOffset = alt1_CFrame.UpVector * 5 -- Move along 'up' direction because orientation changed local rightOffset = alt1_CFrame.UpVector * -5or experiment with
alt1_CFrame.LookVectororalt1_CFrame.BackVectordepending on desired directions.
Full modified snippet for clarity:
local Players = game:GetService("Players") local RunService = game:GetService("RunService") local specifiedPlayer = Players:FindFirstChild("desktopitemleader") local altplayer1 = Players:FindFirstChild("dekstopminikey") local altplayer2 = Players:FindFirstChild("desktopremotev") local altplayer3 = Players:FindFirstChild("desktopmousec") if not (specifiedPlayer and altplayer1 and altplayer2 and altplayer3) then warn("One or more players not found!") return end 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 vertically right: pitch down 90, roll right 90 local rotationOffset = CFrame.Angles(math.rad(-90), 0, math.rad(-90)) local function updateAlts() local baseCFrame = getTorsoCFrame(specifiedPlayer) if not baseCFrame then warn("Specified player torso not found") return end local downOffset = Vector3.new(0, -4, 0) local basePos = baseCFrame.Position + downOffset local baseRotation = baseCFrame - baseCFrame.Position local alt1_CFrame = CFrame.new(basePos) * baseRotation * rotationOffset -- Adjust offsets to UpVector due to rotation change local leftOffset = alt1_CFrame.UpVector * 5 local rightOffset = alt1_CFrame.UpVector * -5 local alt2_CFrame = alt1_CFrame + leftOffset 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)
If this still isn't exactly the orientation you want, please specify more precisely which direction (world axis or player-relative) the alts should face or rotate toward!
- User
how to make altplayer1,2,3 match position and rotation fast and not like specifiedplayer moves and only then altplayer1,2,3
- Assistant
To make altplayer1, 2, 3 immediately and smoothly match the position and rotation of the specified player—so they always keep in sync instantly (no visible lag or delayed response)—you want to:
Key points for fast matching:
- Update the alt players' positions and rotations every frame without interpolation delay.
- Possibly disable any physics or joint constraints on alt players' torsos that might "resist" direct CFrame manipulation.
- Use
.CFrame = targetCFramedirectly, because certain methods likeTweenPositionorBodyMoverscause smooth but delayed motion. - If players have Humanoids and physics, consider setting their
Humanoid.PlatformStand = trueto prevent physics conflicts when teleporting parts manually.
What to do in your script:
You're already updating every frame (on
RunService.Heartbeat), settingtorso.CFrame = ..., so that part is correct.Make sure:
- The players (
altplayer1, etc.) are not moving by physics or animations conflicting with your manual CFrame setting. - You set
Humanoid.PlatformStand = trueon alt players so Roblox physics does not interfere. - If alt players have velocity or BodyMovers active, remove or disable them.
Example modification to your script:
local function setTorsoCFrame(player, cframe) if player.Character then local humanoid = player.Character:FindFirstChildOfClass("Humanoid") local torso = player.Character:FindFirstChild("Torso") or player.Character:FindFirstChild("UpperTorso") if torso then -- Disable physics interference if humanoid then humanoid.PlatformStand = true end -- Directly set the CFrame without interpolation torso.CFrame = cframe end end end
Additional Tips:
-
If you want the alt players to fully replicate the specified player’s movement and rotation instantly, you might want to consider welding their parts programmatically or parenting their entire character to a
Modelthat you move. -
Alternatively, you can directly set their entire character CFrame (for R6/flagged or R15 rigs, this is more complex).
-
Using
HeartbeatorSteppedevent is good because it runs every frame.
Potential physics conflicts:
- If alt players jump or the Humanoid tries to control the torso, it will conflict with your CFrame assignments. You may also want to freeze their movement or disable gravity for them:
humanoid.PlatformStand = true- Optionally set BodyVelocity or other BodyMovers to zero or remove them.
Summary:
- Keep your per-frame update event (on Heartbeat).
- Inside the update, set alt torsos
.CFrame = ...directly. - Disable Humanoid physics by setting
PlatformStand = true. - Remove conflicting physics objects if any.
If you want, I can help you write a full example incorporating these changes!
- User
can you provide me full script
- Assistant
Certainly! Here's a complete script that makes
altplayer1,altplayer2, andaltplayer3instantly match the position and rotation ofspecifiedPlayer’s torso — updating every frame for smooth immediate synchronization — and disables physics interference by settingHumanoid.PlatformStand = trueon alt players.
local Players = game:GetService("Players") local RunService = game:GetService("RunService") -- Change these to your actual player names local specifiedPlayer = Players:FindFirstChild("desktopitemleader") local altplayer1 = Players:FindFirstChild("dekstopminikey") local altplayer2 = Players:FindFirstChild("desktopremotev") local altplayer3 = Players:FindFirstChild("desktopmousec") if not (specifiedPlayer and altplayer1 and altplayer2 and altplayer3) then warn("One or more players not found!") return end 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: rotate vertically right (pitch -90, roll -90) local rotationOffset = CFrame.Angles(math.rad(-90), 0, math.rad(-90)) local function setTorsoCFrame(player, cframe) if player.Character then local humanoid = player.Character:FindFirstChildOfClass("Humanoid") local torso = player.Character:FindFirstChild("Torso") or player.Character:FindFirstChild("UpperTorso") if torso then -- Disable physics interference for smooth immediate control if humanoid then humanoid.PlatformStand = true end torso.CFrame = cframe end end end local function updateAlts() local baseCFrame = getTorsoCFrame(specifiedPlayer) if not baseCFrame then warn("Specified player torso not found") return end local downOffset = Vector3.new(0, -4, 0) local basePos = baseCFrame.Position + downOffset local baseRotation = baseCFrame - baseCFrame.Position local alt1_CFrame = CFrame.new(basePos) * baseRotation * rotationOffset -- Adjust offsets to UpVector due to rotation change local leftOffset = alt1_CFrame.UpVector * 5 local rightOffset = alt1_CFrame.UpVector * -5 local alt2_CFrame = alt1_CFrame + leftOffset local alt3_CFrame = alt1_CFrame + rightOffset setTorsoCFrame(altplayer1, alt1_CFrame) setTorsoCFrame(altplayer2, alt2_CFrame) setTorsoCFrame(altplayer3, alt3_CFrame) end -- Update every frame for instant matching RunService.Heartbeat:Connect(updateAlts)
Explanation:
- The script finds the four players by name.
- Uses the specified player’s torso CFrame as the base.
- Applies the vertical-right rotation offset.
- Computes offsets for alt players to be positioned relative to altplayer1.
- Disables Humanoid movement physics on alt players (
PlatformStand = true) so the torso can be moved immediately without physics interference. - Updates every frame on
RunService.Heartbeat, so the alt players instantly follow the specified player’s torso position and rotation.
Important:
- Ensure this script is running server-side (e.g., inside
ServerScriptService). - Alt players should have their characters loaded; otherwise
Characteror torso may benil. - Disabling
PlatformStandprevents normal player control for alt players while this script runs. - If you want to restore control later, set
humanoid.PlatformStand = falseappropriately.
Let me know if you want me to add smooth transitions or handle player load/unload events!
- User
also can you make altplayer2 pitched by 120 degrees up and altplayer3 pitched down by 120 degrees downwards
- Assistant
Certainly! You want:
altplayer1rotated vertically right by your original rotation offset (pitch -90°,roll -90°).altplayer2pitched 120 degrees up relative to that base rotation.altplayer3pitched 120 degrees down relative to the base rotation.
Here’s how to do that:
We start from the same base rotation for
altplayer1, then apply additional pitch rotations foraltplayer2andaltplayer3respectively.
Updated full script with the requested pitch rotations for altplayer2 and altplayer3:
local Players = game:GetService("Players") local RunService = game:GetService("RunService") -- Change these to your actual player names local specifiedPlayer = Players:FindFirstChild("desktopitemleader") local altplayer1 = Players:FindFirstChild("dekstopminikey") local altplayer2 = Players:FindFirstChild("desktopremotev") local altplayer3 = Players:FindFirstChild("desktopmousec") if not (specifiedPlayer and altplayer1 and altplayer2 and altplayer3) then warn("One or more players not found!") return end 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 -- Base rotation offset: vertical right (pitch -90°, roll -90°) local baseRotationOffset = CFrame.Angles(math.rad(-90), 0, math.rad(-90)) local function setTorsoCFrame(player, cframe) if player.Character then local humanoid = player.Character:FindFirstChildOfClass("Humanoid") local torso = player.Character:FindFirstChild("Torso") or player.Character:FindFirstChild("UpperTorso") if torso then -- Disable physics interference for smooth immediate control if humanoid then humanoid.PlatformStand = true end torso.CFrame = cframe end end end local function updateAlts() local baseCFrame = getTorsoCFrame(specifiedPlayer) if not baseCFrame then warn("Specified player torso not found") return end local downOffset = Vector3.new(0, -4, 0) local basePos = baseCFrame.Position + downOffset -- Extract rotation (remove position) from specified player's torso CFrame local baseRotation = baseCFrame - baseCFrame.Position -- altplayer1: base position + base rotation + baseRotationOffset local alt1_CFrame = CFrame.new(basePos) * baseRotation * baseRotationOffset -- altplayer2: same position as alt1, but pitched 120° up (around X axis) local alt2_rotationOffset = baseRotationOffset * CFrame.Angles(math.rad(120), 0, 0) local alt2_CFrame = CFrame.new(basePos) * baseRotation * alt2_rotationOffset -- altplayer3: same position as alt1, but pitched 120° down (around X axis) local alt3_rotationOffset = baseRotationOffset * CFrame.Angles(math.rad(-120), 0, 0) local alt3_CFrame = CFrame.new(basePos) * baseRotation * alt3_rotationOffset -- Position offsets left/right relative to altplayer1 -- Using UpVector since rotation changed local leftOffset = alt1_CFrame.UpVector * 5 local rightOffset = alt1_CFrame.UpVector * -5 -- Apply position offsets to alt2 and alt3 alt2_CFrame = alt2_CFrame + leftOffset alt3_CFrame = alt3_CFrame + rightOffset setTorsoCFrame(altplayer1, alt1_CFrame) setTorsoCFrame(altplayer2, alt2_CFrame) setTorsoCFrame(altplayer3, alt3_CFrame) end -- Update every frame for instant matching RunService.Heartbeat:Connect(updateAlts)
What changed?
- We kept your original vertical-right rotation for
altplayer1inbaseRotationOffset. - For
altplayer2, we multiplybaseRotationOffsetby an extra pitch rotationCFrame.Angles(math.rad(120), 0, 0)(pitch up 120°). - For
altplayer3, we multiply byCFrame.Angles(math.rad(-120), 0, 0)(pitch down 120°). - Both altplayer2 and altplayer3 are offset horizontally relative to altplayer1 via their
UpVector. - The position offset remains the same, creating spread from altplayer1 to altplayer2 (left/up) and altplayer3 (right/down).
If you want to adjust the amount or axis of rotation, feel free to ask!
- User
also how to make altplayer2,3 be 1 stud more up?
- Assistant
To make altplayer2 and altplayer3 positioned 1 stud higher than their current positions, you simply need to add a vertical offset (
Vector3.new(0, 1, 0)) to their finalCFramepositions.
How to do it in your script:
After you calculate
alt2_CFrameandalt3_CFramewith the rotation and left/right offsets, addVector3.new(0, 1, 0)to their positions like this:-- Apply position offsets to alt2 and alt3 alt2_CFrame = alt2_CFrame + leftOffset + Vector3.new(0, 1, 0) alt3_CFrame = alt3_CFrame + rightOffset + Vector3.new(0, 1, 0)
Full relevant snippet with this change:
-- Position offsets left/right relative to altplayer1 local leftOffset = alt1_CFrame.UpVector * 5 local rightOffset = alt1_CFrame.UpVector * -5 -- Add 1 stud vertical offset to altplayer2 and altplayer3 local verticalOffset = Vector3.new(0, 1, 0) alt2_CFrame = alt2_CFrame + leftOffset + verticalOffset alt3_CFrame = alt3_CFrame + rightOffset + verticalOffset
Summary:
Vector3.new(0, 1, 0)is the "up 1 stud" in world coordinates.- We add this after rotation and horizontal offsets so altplayer2 and altplayer3 move exactly 1 stud higher.
Let me know if you want me to provide the full updated script with this!
- User
can you provide me the full script
- Assistant
Certainly! Here's the full updated script with altplayer2 and altplayer3 positioned 1 stud higher than altplayer1, along with the requested rotations and offsets:
local Players = game:GetService("Players") local RunService = game:GetService("RunService") -- Change these to your actual player names local specifiedPlayer = Players:FindFirstChild("desktopitemleader") local altplayer1 = Players:FindFirstChild("dekstopminikey") local altplayer2 = Players:FindFirstChild("desktopremotev") local altplayer3 = Players:FindFirstChild("desktopmousec") if not (specifiedPlayer and altplayer1 and altplayer2 and altplayer3) then warn("One or more players not found!") return end 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 -- Base rotation offset: vertical right (pitch -90°, roll -90°) local baseRotationOffset = CFrame.Angles(math.rad(-90), 0, math.rad(-90)) local function setTorsoCFrame(player, cframe) if player.Character then local humanoid = player.Character:FindFirstChildOfClass("Humanoid") local torso = player.Character:FindFirstChild("Torso") or player.Character:FindFirstChild("UpperTorso") if torso then -- Disable physics interference for smooth immediate control if humanoid then humanoid.PlatformStand = true end torso.CFrame = cframe end end end local function updateAlts() local baseCFrame = getTorsoCFrame(specifiedPlayer) if not baseCFrame then warn("Specified player torso not found") return end local downOffset = Vector3.new(0, -4, 0) local basePos = baseCFrame.Position + downOffset -- Extract rotation (remove position) from specified player's torso CFrame local baseRotation = baseCFrame - baseCFrame.Position -- altplayer1: base position + base rotation + baseRotationOffset local alt1_CFrame = CFrame.new(basePos) * baseRotation * baseRotationOffset -- altplayer2: same position as alt1, but pitched 120° up (around X axis) local alt2_rotationOffset = baseRotationOffset * CFrame.Angles(math.rad(120), 0, 0) local alt2_CFrame = CFrame.new(basePos) * baseRotation * alt2_rotationOffset -- altplayer3: same position as alt1, but pitched 120° down (around X axis) local alt3_rotationOffset = baseRotationOffset * CFrame.Angles(math.rad(-120), 0, 0) local alt3_CFrame = CFrame.new(basePos) * baseRotation * alt3_rotationOffset -- Position offsets left/right relative to altplayer1 local leftOffset = alt1_CFrame.UpVector * 5 local rightOffset = alt1_CFrame.UpVector * -5 -- Add 1 stud vertical offset to altplayer2 and altplayer3 local verticalOffset = Vector3.new(0, 1, 0) alt2_CFrame = alt2_CFrame + leftOffset + verticalOffset alt3_CFrame = alt3_CFrame + rightOffset + verticalOffset setTorsoCFrame(altplayer1, alt1_CFrame) setTorsoCFrame(altplayer2, alt2_CFrame) setTorsoCFrame(altplayer3, alt3_CFrame) end -- Update every frame for instant matching RunService.Heartbeat:Connect(updateAlts)
What this script does:
- Keeps altplayer1 rotated vertically right (pitch -90°, roll -90°).
- Altplayer2 is pitched 120° up from that base rotation and moved 5 studs left plus 1 stud up.
- Altplayer3 is pitched 120° down and moved 5 studs right plus 1 stud up.
- Updates every frame to instantly match the specified player's torso location and rotation.
- Disables physics interference so the alt players’ torsos move smoothly.
Let me know if you need further adjustments!
- User
can you also add there altplayer4 and altplayer5 so altplayer4 will match position and rotation of altplayer1 but will be 2 more studs left relative to specifiedplayer torso and also altplayer4 will be rolled by 90 and altplayer5 will do the same but he will be 3 studs more right relative to specifiedplayer torso
- Assistant
Certainly! I've added
altplayer4andaltplayer5to your script with the requested behavior:altplayer4matches the position and rotation ofaltplayer1, but offset 2 studs left relative to the specified player's torso position, and rolled by 90 degrees.altplayer5also matchesaltplayer1's rotation with that extra roll, but offset 3 studs right relative to the specified player's torso.
Full updated script with altplayer4 and altplayer5:
local Players = game:GetService("Players") local RunService = game:GetService("RunService") -- Change these to your actual player names local specifiedPlayer = Players:FindFirstChild("desktopitemleader") local altplayer1 = Players:FindFirstChild("dekstopminikey") local altplayer2 = Players:FindFirstChild("desktopremotev") local altplayer3 = Players:FindFirstChild("desktopmousec") local altplayer4 = Players:FindFirstChild("YourAltPlayer4Name") -- replace with actual name local altplayer5 = Players:FindFirstChild("YourAltPlayer5Name") -- replace with actual name if not (specifiedPlayer and altplayer1 and altplayer2 and altplayer3 and altplayer4 and altplayer5) then warn("One or more players not found!") return end 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 -- Base rotation offset: vertical right (pitch -90°, roll -90°) local baseRotationOffset = CFrame.Angles(math.rad(-90), 0, math.rad(-90)) local function setTorsoCFrame(player, cframe) if player.Character then local humanoid = player.Character:FindFirstChildOfClass("Humanoid") local torso = player.Character:FindFirstChild("Torso") or player.Character:FindFirstChild("UpperTorso") if torso then -- Disable physics interference for smooth immediate control if humanoid then humanoid.PlatformStand = true end torso.CFrame = cframe end end end local function updateAlts() local baseCFrame = getTorsoCFrame(specifiedPlayer) if not baseCFrame then warn("Specified player torso not found") return end local downOffset = Vector3.new(0, -4, 0) local basePos = baseCFrame.Position + downOffset -- Extract rotation (remove position) from specified player's torso CFrame local baseRotation = baseCFrame - baseCFrame.Position -- altplayer1: base position + base rotation + baseRotationOffset local alt1_CFrame = CFrame.new(basePos) * baseRotation * baseRotationOffset -- altplayer2: pitched 120° up relative to base rotation local alt2_rotationOffset = baseRotationOffset * CFrame.Angles(math.rad(120), 0, 0) local alt2_CFrame = CFrame.new(basePos) * baseRotation * alt2_rotationOffset -- altplayer3: pitched 120° down relative to base rotation local alt3_rotationOffset = baseRotationOffset * CFrame.Angles(math.rad(-120), 0, 0) local alt3_CFrame = CFrame.new(basePos) * baseRotation * alt3_rotationOffset -- Offsets left/right relative to altplayer1 base CFrame local leftOffset = alt1_CFrame.UpVector * 5 local rightOffset = alt1_CFrame.UpVector * -5 -- 1 stud vertical offset for alt2 and alt3 local verticalOffset = Vector3.new(0, 1, 0) alt2_CFrame = alt2_CFrame + leftOffset + verticalOffset alt3_CFrame = alt3_CFrame + rightOffset + verticalOffset -- New: altplayer4 and altplayer5 -- roll offset by 90 degrees right for both local roll90 = CFrame.Angles(0, 0, math.rad(90)) local rollOffsetRotation = baseRotation * baseRotationOffset * roll90 -- Positions relative to specifiedPlayer torso (world space) local alt4Pos = basePos + (baseCFrame.RightVector * -2) -- 2 studs left local alt5Pos = basePos + (baseCFrame.RightVector * 3) -- 3 studs right local alt4_CFrame = CFrame.new(alt4Pos) * rollOffsetRotation local alt5_CFrame = CFrame.new(alt5Pos) * rollOffsetRotation -- Set CFrames for all alt players setTorsoCFrame(altplayer1, alt1_CFrame) setTorsoCFrame(altplayer2, alt2_CFrame) setTorsoCFrame(altplayer3, alt3_CFrame) setTorsoCFrame(altplayer4, alt4_CFrame) setTorsoCFrame(altplayer5, alt5_CFrame) end -- Update every frame for instant matching RunService.Heartbeat:Connect(updateAlts)
What to do next:
- Replace
"YourAltPlayer4Name"and"YourAltPlayer5Name"with the actual player names in your game. altplayer4is offset 2 studs left of the specified player's torso position (basePos) and rotated likealtplayer1but with an additional 90° roll.altplayer5is offset 3 studs right with the same rotation asaltplayer4.- All altplayers have their physics disabled (
PlatformStand = true) for immediate frame-by-frame positioning.
Feel free to ask if you want me to help with any additional functionality!
- User
also how to make altplayer4,5 be 2 studs more down
- Assistant
To make altplayer4 and altplayer5 positioned 2 studs lower (down) relative to their current positions, you just add a downward offset
Vector3.new(0, -2, 0)when calculating their final positions.
Update this part of your script:
Currently, you have:
local alt4Pos = basePos + (baseCFrame.RightVector * -2) -- 2 studs left local alt5Pos = basePos + (baseCFrame.RightVector * 3) -- 3 studs rightChange to:
local downOffset = Vector3.new(0, -2, 0) local alt4Pos = basePos + (baseCFrame.RightVector * -2) + downOffset -- 2 studs left and 2 down local alt5Pos = basePos + (baseCFrame.RightVector * 3) + downOffset -- 3 studs right and 2 down
Here’s the relevant snippet with that included:
-- New: altplayer4 and altplayer5 local roll90 = CFrame.Angles(0, 0, math.rad(90)) local rollOffsetRotation = baseRotation * baseRotationOffset * roll90 -- Downward offset of 2 studs local downOffset = Vector3.new(0, -2, 0) local alt4Pos = basePos + (baseCFrame.RightVector * -2) + downOffset local alt5Pos = basePos + (baseCFrame.RightVector * 3) + downOffset local alt4_CFrame = CFrame.new(alt4Pos) * rollOffsetRotation local alt5_CFrame = CFrame.new(alt5Pos) * rollOffsetRotation
This will position altplayer4 and altplayer5 two studs lower than their original positions while keeping their left/right offsets relative to the specified player's torso.
If you want, I can provide the full updated script including this change!
- User
can you provideme the full script
- Assistant
Certainly! Here's the full updated script with altplayer4 and altplayer5 positioned 2 studs lower (down), rolled by 90 degrees, and offset 2 studs left and 3 studs right respectively relative to the specified player's torso:
local Players = game:GetService("Players") local RunService = game:GetService("RunService") -- Change these to your actual player names local specifiedPlayer = Players:FindFirstChild("desktopitemleader") local altplayer1 = Players:FindFirstChild("dekstopminikey") local altplayer2 = Players:FindFirstChild("desktopremotev") local altplayer3 = Players:FindFirstChild("desktopmousec") local altplayer4 = Players:FindFirstChild("YourAltPlayer4Name") -- replace with actual name local altplayer5 = Players:FindFirstChild("YourAltPlayer5Name") -- replace with actual name if not (specifiedPlayer and altplayer1 and altplayer2 and altplayer3 and altplayer4 and altplayer5) then warn("One or more players not found!") return end 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 -- Base rotation offset: vertical right (pitch -90°, roll -90°) local baseRotationOffset = CFrame.Angles(math.rad(-90), 0, math.rad(-90)) local function setTorsoCFrame(player, cframe) if player.Character then local humanoid = player.Character:FindFirstChildOfClass("Humanoid") local torso = player.Character:FindFirstChild("Torso") or player.Character:FindFirstChild("UpperTorso") if torso then -- Disable physics interference for smooth immediate control if humanoid then humanoid.PlatformStand = true end torso.CFrame = cframe end end end local function updateAlts() local baseCFrame = getTorsoCFrame(specifiedPlayer) if not baseCFrame then warn("Specified player torso not found") return end local downOffset = Vector3.new(0, -4, 0) local basePos = baseCFrame.Position + downOffset -- Extract rotation (remove position) from specified player's torso CFrame local baseRotation = baseCFrame - baseCFrame.Position -- altplayer1: base position + base rotation + baseRotationOffset local alt1_CFrame = CFrame.new(basePos) * baseRotation * baseRotationOffset -- altplayer2: pitched 120° up relative to base rotation local alt2_rotationOffset = baseRotationOffset * CFrame.Angles(math.rad(120), 0, 0) local alt2_CFrame = CFrame.new(basePos) * baseRotation * alt2_rotationOffset -- altplayer3: pitched 120° down relative to base rotation local alt3_rotationOffset = baseRotationOffset * CFrame.Angles(math.rad(-120), 0, 0) local alt3_CFrame = CFrame.new(basePos) * baseRotation * alt3_rotationOffset -- Offsets left/right relative to altplayer1 base CFrame local leftOffset = alt1_CFrame.UpVector * 5 local rightOffset = alt1_CFrame.UpVector * -5 -- 1 stud vertical offset for alt2 and alt3 local verticalOffset = Vector3.new(0, 1, 0) alt2_CFrame = alt2_CFrame + leftOffset + verticalOffset alt3_CFrame = alt3_CFrame + rightOffset + verticalOffset -- altplayer4 and altplayer5 local roll90 = CFrame.Angles(0, 0, math.rad(90)) local rollOffsetRotation = baseRotation * baseRotationOffset * roll90 -- 2 studs down offset local altDownOffset = Vector3.new(0, -2, 0) local alt4Pos = basePos + (baseCFrame.RightVector * -2) + altDownOffset -- 2 studs left, 2 down local alt5Pos = basePos + (baseCFrame.RightVector * 3) + altDownOffset -- 3 studs right, 2 down local alt4_CFrame = CFrame.new(alt4Pos) * rollOffsetRotation local alt5_CFrame = CFrame.new(alt5Pos) * rollOffsetRotation -- Set CFrames for all alt players setTorsoCFrame(altplayer1, alt1_CFrame) setTorsoCFrame(altplayer2, alt2_CFrame) setTorsoCFrame(altplayer3, alt3_CFrame) setTorsoCFrame(altplayer4, alt4_CFrame) setTorsoCFrame(altplayer5, alt5_CFrame) end -- Update every frame for instant matching RunService.Heartbeat:Connect(updateAlts)
Remember to replace
"YourAltPlayer4Name"and"YourAltPlayer5Name"with the actual player names in your game.
If you need anything else, feel free to ask!
- User
also how to make altplayer4,5 spin around whit 5 speed when specifiedplayer moves and altplayer4,5 will stop spinning when specifiedplayer doesnt move and just idles and also can u make specifiedplayer walkspeed set to 30 and hipheight to 3
- Assistant
Certainly! Here's how to address each part of your request:
Goals:
- Make altplayer4 and altplayer5 spin around while specifiedPlayer is moving, at speed 5.
- Stop the spinning when specifiedPlayer stops moving (idles).
- Set specifiedPlayer's WalkSpeed to 30 and HipHeight to 3.
How to detect movement:
Check the velocity magnitude of the
specifiedPlayer’s HumanoidRootPart (or torso). If velocity is above a small threshold, consider the player moving.
How to spin altplayer4 and altplayer5:
Add a rotation around the Y-axis (up-axis) every frame multiplied by spin speed only while moving.
WalkSpeed and HipHeight:
Set these once after the character is loaded, and update accordingly when character respawns.
Full updated script implementing all:
local Players = game:GetService("Players") local RunService = game:GetService("RunService") -- Change these to your actual player names local specifiedPlayer = Players:FindFirstChild("desktopitemleader") local altplayer1 = Players:FindFirstChild("dekstopminikey") local altplayer2 = Players:FindFirstChild("desktopremotev") local altplayer3 = Players:FindFirstChild("desktopmousec") local altplayer4 = Players:FindFirstChild("YourAltPlayer4Name") -- replace local altplayer5 = Players:FindFirstChild("YourAltPlayer5Name") -- replace if not (specifiedPlayer and altplayer1 and altplayer2 and altplayer3 and altplayer4 and altplayer5) then warn("One or more players not found!") return end local SP_MOVE_THRESHOLD = 0.1 -- velocity threshold to detect movement local SPIN_SPEED = 5 -- radians per second spin speed 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 local function getHumanoid(player) local character = player.Character if character then return character:FindFirstChildOfClass("Humanoid") end return nil end local function getHumanoidRootPart(player) local character = player.Character if character then return character:FindFirstChild("HumanoidRootPart") end return nil end -- Base rotation offset (vertical right) local baseRotationOffset = CFrame.Angles(math.rad(-90), 0, math.rad(-90)) local function setTorsoCFrame(player, cframe) if player.Character then local humanoid = player.Character:FindFirstChildOfClass("Humanoid") local torso = player.Character:FindFirstChild("Torso") or player.Character:FindFirstChild("UpperTorso") if torso then if humanoid then humanoid.PlatformStand = true end torso.CFrame = cframe end end end -- Set WalkSpeed and HipHeight, also hook respawn local function setupSpecifiedPlayer() local humanoid = getHumanoid(specifiedPlayer) if humanoid then humanoid.WalkSpeed = 30 humanoid.HipHeight = 3 end specifiedPlayer.CharacterAdded:Connect(function(char) local hum = char:WaitForChild("Humanoid") hum.WalkSpeed = 30 hum.HipHeight = 3 end) end setupSpecifiedPlayer() -- Variables to track spinning angle local spinAngle = 0 local function updateAlts(dt) local baseCFrame = getTorsoCFrame(specifiedPlayer) local humanoidRoot = getHumanoidRootPart(specifiedPlayer) if not baseCFrame or not humanoidRoot then warn("Specified player torso or HumanoidRootPart not found") return end local velocity = humanoidRoot.Velocity local isMoving = velocity.Magnitude > SP_MOVE_THRESHOLD local downOffset = Vector3.new(0, -4, 0) local basePos = baseCFrame.Position + downOffset local baseRotation = baseCFrame - baseCFrame.Position -- altplayer1 setup as before local alt1_CFrame = CFrame.new(basePos) * baseRotation * baseRotationOffset -- altplayer2 pitched 120° up local alt2_rotationOffset = baseRotationOffset * CFrame.Angles(math.rad(120), 0, 0) local alt2_CFrame = CFrame.new(basePos) * baseRotation * alt2_rotationOffset -- altplayer3 pitched 120° down local alt3_rotationOffset = baseRotationOffset * CFrame.Angles(math.rad(-120), 0, 0) local alt3_CFrame = CFrame.new(basePos) * baseRotation * alt3_rotationOffset -- left/right offset vectors relative to alt1 local leftOffset = alt1_CFrame.UpVector * 5 local rightOffset = alt1_CFrame.UpVector * -5 local verticalOffset = Vector3.new(0, 1, 0) alt2_CFrame = alt2_CFrame + leftOffset + verticalOffset alt3_CFrame = alt3_CFrame + rightOffset + verticalOffset -- altplayer4 & 5 position + roll 90 local roll90 = CFrame.Angles(0, 0, math.rad(90)) local rollOffsetRotation = baseRotation * baseRotationOffset * roll90 local altDownOffset = Vector3.new(0, -2, 0) local rightVec = baseCFrame.RightVector local alt4Pos = basePos + (rightVec * -2) + altDownOffset local alt5Pos = basePos + (rightVec * 3) + altDownOffset -- Spin logic: update spin angle if moving if isMoving then spinAngle = (spinAngle + SPIN_SPEED * dt) % (2 * math.pi) end local spinRotation = CFrame.Angles(0, spinAngle, 0) local alt4_CFrame = CFrame.new(alt4Pos) * rollOffsetRotation * spinRotation local alt5_CFrame = CFrame.new(alt5Pos) * rollOffsetRotation * spinRotation -- Set all alt player torsos setTorsoCFrame(altplayer1, alt1_CFrame) setTorsoCFrame(altplayer2, alt2_CFrame) setTorsoCFrame(altplayer3, alt3_CFrame) setTorsoCFrame(altplayer4, alt4_CFrame) setTorsoCFrame(altplayer5, alt5_CFrame) end RunService.Heartbeat:Connect(updateAlts)
Explanation of code changes:
- Movement detection: checks
HumanoidRootPart.Velocity.Magnitudeto know ifspecifiedPlayeris moving. - Spin angle update: only increases when moving; stops increasing (stops spinning) when idle.
- Spin applied by multiplying
altplayer4andaltplayer5's rotation by a Y-axis rotationspinRotation. WalkSpeedandHipHeightforspecifiedPlayerare set on startup and on respawn.- Spin speed is radians per second; you can adjust
SPIN_SPEEDas needed.
Let me know if you want me to adjust spin axis, speed, or anything else!
- User
how to make altplayer4,5 spin more faster
- Assistant
To make altplayer4 and altplayer5 spin faster, simply increase the
SPIN_SPEEDvalue in your script.
Where to change:
local SPIN_SPEED = 5 -- current spin speed in radians per secondFor example, to double the spin speed:
local SPIN_SPEED = 10Or for even faster spin:
local SPIN_SPEED = 20
Summary:
- The
SPIN_SPEEDvariable controls how fast altplayer4 and altplayer5 spin. - It’s measured in radians per second, so higher values = faster spinning.
- Adjust the number according to how fast you want the spin animation.
If you want, I can update your script with the new speed—just tell me the desired spins per second or degrees per second!
- The
- User
can you also make altplayer1 1 stud lower and can you provide me full script whit faster spinning and altplayer1 being 1 stud lower?
- Assistant
Certainly! Here is the full updated script with the following adjustments:
altplayer1positioned 1 stud lower than before.altplayer4andaltplayer5spin faster (I've doubled the spin speed from 5 to 10 radians per second, you can adjust if needed).
local Players = game:GetService("Players") local RunService = game:GetService("RunService") -- Change these to your actual player names local specifiedPlayer = Players:FindFirstChild("desktopitemleader") local altplayer1 = Players:FindFirstChild("dekstopminikey") local altplayer2 = Players:FindFirstChild("desktopremotev") local altplayer3 = Players:FindFirstChild("desktopmousec") local altplayer4 = Players:FindFirstChild("YourAltPlayer4Name") -- replace with actual name local altplayer5 = Players:FindFirstChild("YourAltPlayer5Name") -- replace with actual name if not (specifiedPlayer and altplayer1 and altplayer2 and altplayer3 and altplayer4 and altplayer5) then warn("One or more players not found!") return end local SP_MOVE_THRESHOLD = 0.1 -- velocity threshold to detect movement local SPIN_SPEED = 10 -- radians per second spin speed (doubled from 5) 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 local function getHumanoid(player) local character = player.Character if character then return character:FindFirstChildOfClass("Humanoid") end return nil end local function getHumanoidRootPart(player) local character = player.Character if character then return character:FindFirstChild("HumanoidRootPart") end return nil end -- Base rotation offset: vertical right (pitch -90°, roll -90°) local baseRotationOffset = CFrame.Angles(math.rad(-90), 0, math.rad(-90)) local function setTorsoCFrame(player, cframe) if player.Character then local humanoid = player.Character:FindFirstChildOfClass("Humanoid") local torso = player.Character:FindFirstChild("Torso") or player.Character:FindFirstChild("UpperTorso") if torso then if humanoid then humanoid.PlatformStand = true end torso.CFrame = cframe end end end -- Set WalkSpeed and HipHeight, also hook respawn local function setupSpecifiedPlayer() local humanoid = getHumanoid(specifiedPlayer) if humanoid then humanoid.WalkSpeed = 30 humanoid.HipHeight = 3 end specifiedPlayer.CharacterAdded:Connect(function(char) local hum = char:WaitForChild("Humanoid") hum.WalkSpeed = 30 hum.HipHeight = 3 end) end setupSpecifiedPlayer() local spinAngle = 0 local function updateAlts(dt) local baseCFrame = getTorsoCFrame(specifiedPlayer) local humanoidRoot = getHumanoidRootPart(specifiedPlayer) if not baseCFrame or not humanoidRoot then warn("Specified player torso or HumanoidRootPart not found") return end local velocity = humanoidRoot.Velocity local isMoving = velocity.Magnitude > SP_MOVE_THRESHOLD -- altplayer1 down offset increased by 1 stud lower (additional -1 on Y) local downOffset = Vector3.new(0, -5, 0) -- was -4, now -5 local basePos = baseCFrame.Position + downOffset local baseRotation = baseCFrame - baseCFrame.Position -- altplayer1: base position + base rotation + baseRotationOffset local alt1_CFrame = CFrame.new(basePos) * baseRotation * baseRotationOffset -- altplayer2: pitched 120° up relative to base rotation local alt2_rotationOffset = baseRotationOffset * CFrame.Angles(math.rad(120), 0, 0) local alt2_CFrame = CFrame.new(basePos) * baseRotation * alt2_rotationOffset -- altplayer3: pitched 120° down relative to base rotation local alt3_rotationOffset = baseRotationOffset * CFrame.Angles(math.rad(-120), 0, 0) local alt3_CFrame = CFrame.new(basePos) * baseRotation * alt3_rotationOffset local leftOffset = alt1_CFrame.UpVector * 5 local rightOffset = alt1_CFrame.UpVector * -5 local verticalOffset = Vector3.new(0, 1, 0) alt2_CFrame = alt2_CFrame + leftOffset + verticalOffset alt3_CFrame = alt3_CFrame + rightOffset + verticalOffset -- altplayer4 and altplayer5 settings local roll90 = CFrame.Angles(0, 0, math.rad(90)) local rollOffsetRotation = baseRotation * baseRotationOffset * roll90 local altDownOffset = Vector3.new(0, -2, 0) local rightVec = baseCFrame.RightVector local alt4Pos = basePos + (rightVec * -2) + altDownOffset local alt5Pos = basePos + (rightVec * 3) + altDownOffset -- Update spin angle if specifiedPlayer is moving if isMoving then spinAngle = (spinAngle + SPIN_SPEED * dt) % (2 * math.pi) end local spinRotation = CFrame.Angles(0, spinAngle, 0) local alt4_CFrame = CFrame.new(alt4Pos) * rollOffsetRotation * spinRotation local alt5_CFrame = CFrame.new(alt5Pos) * rollOffsetRotation * spinRotation setTorsoCFrame(altplayer1, alt1_CFrame) setTorsoCFrame(altplayer2, alt2_CFrame) setTorsoCFrame(altplayer3, alt3_CFrame) setTorsoCFrame(altplayer4, alt4_CFrame) setTorsoCFrame(altplayer5, alt5_CFrame) end RunService.Heartbeat:Connect(updateAlts)
Summary of changes:
- Changed
downOffsetfrom(0, -4, 0)to(0, -5, 0)to makealtplayer11 stud lower. - Increased
SPIN_SPEEDfrom 5 to 10 radians per second for faster spin onaltplayer4andaltplayer5.
Let me know if you'd like the spin speed tuned differently or any other tweaks!