can you make the altplayer1 spin when 1 specified player said q and 1 specified player will hover 15 studs above the ground and his walkspeed will be set to 30 and when 1 specified player says e he wont hover above the ground anymore and his walkspeed is going to be set to default and altplayer1 will stop spinning local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
-- Your specified players:
local specifiedPlayer = Players:FindFirstChild("desktopitemleader")
local altPlayer1 = Players:FindFirstChild("desktopcardboard")
local altPlayer2 = Players:FindFirstChild("minidesktopspeaker")
local altPlayer3 = Players:FindFirstChild("dekstopminikey")
local altplayer4 = workspace:WaitForChild("desktopmousec")
local altplayer5 = workspace:WaitForChild("desktopremotev")
-- Cache humanoid root parts, heads and torsos function for clarity
local function getPart(character, partName)
if character then
return character:FindFirstChild(partName)
end
return nil
end
local function updateAltPlayer1()
if specifiedPlayer and specifiedPlayer.Character and altPlayer1 and altPlayer1.Character then
local specifiedHRP = getPart(specifiedPlayer.Character, "HumanoidRootPart")
local altHRP = getPart(altPlayer1.Character, "HumanoidRootPart")
code
if specifiedHRP and altHRP then
-- Position altplayer1 4 studs above specifiedPlayer with no rotation
altHRP.CFrame = CFrame.new(specifiedHRP.Position + Vector3.new(0, 4, 0))
end
end
end
local function updateAltPlayer2Head()
if altPlayer1 and altPlayer1.Character and altPlayer2 and altPlayer2.Character then
local alt1Head = getPart(altPlayer1.Character, "Head")
local alt2Head = getPart(altPlayer2.Character, "Head")
code
if alt1Head and alt2Head then
-- altplayer2 head = altplayer1 head rotated 90 degrees up (around X axis)
local rotatedCFrame = alt1Head.CFrame * CFrame.Angles(-math.rad(90), 0, 0)
alt2Head.CFrame = rotatedCFrame
end
end
end
local function updateAltPlayer3Head()
if altPlayer1 and altPlayer1.Character and altPlayer3 and altPlayer3.Character then
local alt1Head = getPart(altPlayer1.Character, "Head")
local alt3Head = getPart(altPlayer3.Character, "Head")
code
if alt1Head and alt3Head then
-- altplayer3 head = altplayer1 head rotated -90 degrees (90 down) around X axis
local rotatedCFrame = alt1Head.CFrame * CFrame.Angles(math.rad(90), 0, 0)
alt3Head.CFrame = rotatedCFrame
end
end
end
local function updateAltplayer4And5Heads()
-- First get torsos of altPlayer2 and altPlayer3
if altPlayer2 and altPlayer2.Character and altPlayer3 and altPlayer3.Character and altplayer4 and altplayer5 then
local torso2 = getPart(altPlayer2.Character, "Torso")
local torso3 = getPart(altPlayer3.Character, "Torso")
local head4 = altplayer4:FindFirstChild("Head")
local head5 = altplayer5:FindFirstChild("Head")
code
if torso2 and head4 then
head4.CFrame = torso2.CFrame * CFrame.new(0, -2, 0)
end
if torso3 and head5 then
head5.CFrame = torso3.CFrame * CFrame.new(0, -2, 0)
end
end
Certainly! Below is an example of how you can implement the requested behavior:
When the specified player (desktopitemleader) says "q":
altPlayer1 spins continuously.
Another specified player (I'll assume it's altPlayer1 itself in your example, but you can easily adjust to another player if needed) hovers 15 studs above the ground.
This player also gets WalkSpeed set to 30.
When the specified player says "e":
altPlayer1 stops spinning.
The hovered player goes back to normal (hover stops, WalkSpeed reset).
How this code works:
We listen to chat messages from the specified player using the Chatted event.
Use a boolean flag to check if spinning/hovering should be active.
Use RunService.Heartbeat to apply spinning and hovering every frame when active.
Reset properties when turned off.
Your modified script with addition
lua
User
can it be instead of altplayer1 hovering and getting walkspeed its gonna be specifiedPlayer? but altplayer1 will be still one to spin and not when needed
Assistant
Got it! You want:
When the specifiedPlayer says "q":
altPlayer1 starts spinning.
The specifiedPlayer hovers 15 studs above ground and gets WalkSpeed 30.
When the specifiedPlayer says "e":
altPlayer1 stops spinning.
specifiedPlayer stops hovering and WalkSpeed resets to default.
Updated Code snippet for this behavior:
The hover and WalkSpeed changes now apply to specifiedPlayer, while spinning remains on altPlayer1.
lua
User
can you make instead of hovering above the ground specified player hipheight got set to 20? also why altplayer1 isnt spinning
Assistant
Sure! I’ll update the script so instead of raycasting and hovering above the ground, the specifiedPlayer’s HipHeight is set to 20 when hovering is enabled (i.e., after saying "q"), and reset to default (which typically is around 2) when hovering is disabled (after saying "e").
Why might altPlayer1 not be spinning?
Common causes why altPlayer1 might not spin in your current script:
altHRP or altPlayer1’s Character or HumanoidRootPart might be nil when the spin code runs (e.g., character not loaded yet, or died and respawned).
The spinning angle currentRotation might be reset each frame or your spin logic might be overridden by other code.
The positioning or some external script might overwrite the altHRP.CFrame.
In the provided code, we:
Remember rotation angle incrementally to keep spinning continuous.
Use RunService.Heartbeat to spin every frame (around Y-axis).
Avoid resetting rotation to 0 unless stopping spin.
Make sure:
Characters fully loaded before running spin (use CharacterAdded events or wait accordingly).
The spin code and position code do not fight with each other by being called in the same frame or overwriting CFrames.
Updated script snippet with HipHeight change and some fixes:
lua
User
why altplayer4 and 5 are jittering now also altplayer1 still doesnt spin thats wierd
Assistant
Let's troubleshoot and improve your script to solve the jittering of altplayer4 and altplayer5 and the spinning of altPlayer1.
Why altplayer4 and altplayer5 might jitter
Looking at your code:
lua
local function updateAltplayer4And5Heads()
if altPlayer2 and altPlayer2.Character and altPlayer3 and altPlayer3.Character and altplayer4 and altplayer5 then
local torso2 = getPart(altPlayer2.Character, "Torso")
local torso3 = getPart(altPlayer3.Character, "Torso")
local head4 = altplayer4:FindFirstChild("Head")
local head5 = altplayer5:FindFirstChild("Head")
if torso2 and head4 then
head4.CFrame = torso2.CFrame * CFrame.new(0, -2, 0)
end
if torso3 and head5 then
head5.CFrame = torso3.CFrame * CFrame.new(0, -2, 0)
end
end
end
Jitter usually happens because two conflicting scripts or physics are fighting to control the same parts each frame:
head4 and head5 seem to be manually positioned relative to torso parts every Heartbeat.
Are head4 and head5 parts that belong to models that also have physics or welds, or are controlled by an Animation or Motor6D?
If these parts are normally welded to other parts or controlled by Roblox's Motor6Ds (like a player’s Head), your script overwriting their CFrame every frame will cause jitter as physics/animation tries to correct it.
To fix jitter:
Try welding head4 and head5 to the torsos instead of setting CFrame every frame, or
Use Motor6D manipulation instead of setting CFrame directly, or
Disable any other script or animation trying to move these parts, or
If possible, disable physics simulation and collisions for these parts and move them directly using CFrame (sometimes called kinematic parts).
Why altPlayer1 might still not spin
Confirmations:
Is 's assigned and found? Nil parts stop any CFrame changes silently.
Add print statements right after initializing parts:
User
can you provide me script whit altplayer1 spin fixed
Assistant
Certainly! Below is a refined script where I fixed the spinning of altPlayer1 by ensuring the HumanoidRootPart is properly cached and updated, handling character respawns, and avoiding conflicting CFrame assignments. I also left your other updates intact, including specifiedPlayer's HipHeight modification and the previous structure.
Key improvements:
Waits for characters to load and caches parts.
Listens for CharacterAdded to update cached parts on respawn.
Uses a clear incremental rotation variable.
Avoids resetting rotation unnecessarily.
Updates altPlayer1's CFrame only for spinning or fixed position.
Includes debug prints you can comment out/remove once confirmed working.
Complete Script:
lua
User
how to make once altplayer1 rotates he will match position of specifiedPlayer while being 3 studs more up
Assistant
To have altPlayer1 continuously spin while staying positioned exactly at the specifiedPlayer’s position but 3 studs above, you need to:
Each frame, get the specifiedPlayer’s HumanoidRootPart position.
Position altPlayer1’s HumanoidRootPart at that position plus Vector3.new(0, 3, 0).
Apply the spinning rotation around the Y-axis on that position.
Modify the spinning part of your update loop like this:
Replace this spinning code inside your RunService.Heartbeat:
lua
if spinning and altHRP and specifiedHRP then
currentRotation = currentRotation + SPIN_SPEED
-- Make altPlayer1 sit 3 studs above specifiedPlayer, and rotate around Y axis
local targetPos = specifiedHRP.Position + Vector3.new(0, 3, 0)
altHRP.CFrame = CFrame.new(targetPos) * CFrame.Angles(0, currentRotation, 0)
elseif altHRP and specifiedHRP then
-- When not spinning, keep altPlayer1 4 studs above specifiedPlayer (or your preferred offset)
currentRotation = 0
altHRP.CFrame = CFrame.new(specifiedHRP.Position + Vector3.new(0, 4, 0))
end
Explanation:
We get the current position of specifiedHRP.
We add 3 studs upward (+ Vector3.new(0, 3, 0)).
We create a new CFrame at that position.
Then multiply it by a rotation around the Y-axis (CFrame.Angles(0, currentRotation, 0)).
This way, the rotation is applied in place without drifting the position.
When not spinning, the altPlayer1 will be positioned 4 studs above specifiedPlayer as before.
Full snippet integration example (inside your heartbeat):
lua
User
can you integrate the full script
Assistant
Certainly! Here’s your full script with the requested behavior integrated:
When specifiedPlayer says "q":
altPlayer1 spins around its Y-axis.
altPlayer1 is positioned exactly at specifiedPlayer’s HumanoidRootPart plus 3 studs up.
specifiedPlayer’s HipHeight is set to 20 and WalkSpeed to 30.
When specifiedPlayer says "e":
Spinning stops.
altPlayer1 is positioned 4 studs above specifiedPlayer.
specifiedPlayer’s HipHeight and WalkSpeed reset to defaults.
lua
User
also how to disable platformstand of all altplayers when specifiedPlayer said q and reenable platformstand when specifiedPlayer said e
Assistant
You can disable and enable the PlatformStand property of all your alt players' humanoids when the specifiedPlayer says "q" and "e" by looping through them and setting that property accordingly.
Here's how you add that to your existing script:
Step 1: Create a list/array of all alt players you want to affect with PlatformStand toggle:
lua
local altPlayers = {
altPlayer1,
altPlayer2,
altPlayer3,
}
(Add or remove players as needed; altplayer4 and altplayer5 appear to be workspace objects, so handle those differently if they have humanoids.)
Step 2: Create a helper function to set PlatformStand for all alt players:
lua
local function setAltPlayersPlatformStand(value)
for _, player in pairs(altPlayers) do
if player and player.Character then
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.PlatformStand = value
end
end
end
end
Step 3: Call this in your chat commands for "q" and "e":
Modify the chat handler inside your script like this:
lua
if specifiedPlayer then
specifiedPlayer.Chatted:Connect(function(msg)
local message = msg:lower()
if message == "q" then
spinning = true
hovering = true
initializeParts()
if specifiedHumanoid then
specifiedHumanoid.WalkSpeed = HOVER_WALKSPEED
specifiedHumanoid.HipHeight = HOVER_HIPHEIGHT
end
-- Disable platform stand for all alt players
setAltPlayersPlatformStand(false)
elseif message == "e" then
spinning = false
hovering = false
initializeParts()
if specifiedHumanoid then
specifiedHumanoid.WalkSpeed = DEFAULT_WALKSPEED
specifiedHumanoid.HipHeight = DEFAULT_HIPHEIGHT
end
-- Enable platform stand for all alt players
setAltPlayersPlatformStand(true)
updateAltPlayer1Position()
end
end)
end
User
also can u make altplayer1 be instead of 3 studs more high up and he will be 5 studs more high up and can u provide me full script whit platform stand too
Assistant
Certainly! I've updated the full script with the following:
altPlayer1 spins at 5 studs above the specified player's HumanoidRootPart (instead of 3).
PlatformStand is disabled (set to false) for all alt players when specified player says "q".
PlatformStand is enabled (set to true) for all alt players when specified player says "e".
Included altplayer4 and altplayer5 platform stand toggling as well.
Proper handling of character respawns.
Clean and commented for clarity.
Full updated script:
lua
User
also can u make altplayer1 spin faster like 3 times more
Assistant
Certainly! To make altPlayer1 spin 3 times faster, just multiply the spin speed constant by 3.
In your script, replace:
lua
local SPIN_SPEED = math.rad(5)
with
lua
local SPIN_SPEED = math.rad(5 * 3) -- 15 degrees per frame
Here is the updated snippet of the full script with that adjustment:
lua
-- ...
local SPIN_SPEED = math.rad(5 * 3) -- 15 degrees per frame, spinning 3x faster
local currentRotation = 0
-- ...
Or full relevant section for clarity:
lua
local SPIN_SPEED = math.rad(15) -- 15 degrees in radians per frame (3x faster)
local currentRotation = 0
RunService.Heartbeat:Connect(function()
-- ... other updates ...
if spinning and altHRP and specifiedHRP then
currentRotation = currentRotation + SPIN_SPEED
local targetPos = specifiedHRP.Position + Vector3.new(0, 5, 0)
altHRP.CFrame = CFrame.new(targetPos) * CFrame.Angles(0, currentRotation, 0)
elseif altHRP and specifiedHRP then
currentRotation = 0
altHRP.CFrame = CFrame.new(specifiedHRP.Position + Vector3.new(0, 4, 0))
end
end)
If you want me to provide the full complete script again with this spin speed adjustment incorporated, just say so!
Not yet included in a published release.
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
-- Your specified players:
local specifiedPlayer = Players:FindFirstChild("desktopitemleader")
local altPlayer1 = Players:FindFirstChild("desktopcardboard")
local altPlayer2 = Players:FindFirstChild("minidesktopspeaker")
local altPlayer3 = Players:FindFirstChild("dekstopminikey")
local altplayer4 = workspace:WaitForChild("desktopmousec")
local altplayer5 = workspace:WaitForChild("desktopremotev")
-- Cache humanoid root parts, heads and torsos function for clarity
local function getPart(character, partName)
if character then
return character:FindFirstChild(partName)
end
return nil
end
-- Variables to control spinning and hovering states
local spinning = false
local hovering = false
-- Constants
local HOVER_HEIGHT = 15
local HOVER_WALKSPEED = 30
local DEFAULT_WALKSPEED = 16 -- Roblox default walk speed
-- Get humanoid and root parts for altPlayer1 for quick access
local altHRP, altHumanoid
local function initializeAltPlayer1Parts()
if altPlayer1 and altPlayer1.Character then
altHRP = getPart(altPlayer1.Character, "HumanoidRootPart")
altHumanoid = altPlayer1.Character:FindFirstChildOfClass("Humanoid")
else
altHRP = nil
altHumanoid = nil
end
end
-- Call this to preserve update
local function updateAltPlayer1()
if specifiedPlayer and specifiedPlayer.Character and altPlayer1 and altPlayer1.Character then
local specifiedHRP = getPart(specifiedPlayer.Character, "HumanoidRootPart")
altHRP = getPart(altPlayer1.Character, "HumanoidRootPart")
altHumanoid = altPlayer1.Character:FindFirstChildOfClass("Humanoid")
if specifiedHRP and altHRP then
-- Position altplayer1 4 studs above specifiedPlayer with no rotation
altHRP.CFrame = CFrame.new(specifiedHRP.Position + Vector3.new(0, 4, 0))
end
end
end
local function updateAltPlayer2Head()
if altPlayer1 and altPlayer1.Character and altPlayer2 and altPlayer2.Character then
local alt1Head = getPart(altPlayer1.Character, "Head")
local alt2Head = getPart(altPlayer2.Character, "Head")
if alt1Head and alt2Head then
-- altplayer2 head = altplayer1 head rotated 90 degrees up (around X axis)
local rotatedCFrame = alt1Head.CFrame * CFrame.Angles(-math.rad(90), 0, 0)
alt2Head.CFrame = rotatedCFrame
end
end
end
local function updateAltPlayer3Head()
if altPlayer1 and altPlayer1.Character and altPlayer3 and altPlayer3.Character then
local alt1Head = getPart(altPlayer1.Character, "Head")
local alt3Head = getPart(altPlayer3.Character, "Head")
if alt1Head and alt3Head then
-- altplayer3 head = altplayer1 head rotated -90 degrees (90 down) around X axis
local rotatedCFrame = alt1Head.CFrame * CFrame.Angles(math.rad(90), 0, 0)
alt3Head.CFrame = rotatedCFrame
end
end
end
local function updateAltplayer4And5Heads()
-- First get torsos of altPlayer2 and altPlayer3
if altPlayer2 and altPlayer2.Character and altPlayer3 and altPlayer3.Character and altplayer4 and altplayer5 then
local torso2 = getPart(altPlayer2.Character, "Torso")
local torso3 = getPart(altPlayer3.Character, "Torso")
local head4 = altplayer4:FindFirstChild("Head")
local head5 = altplayer5:FindFirstChild("Head")
if torso2 and head4 then
head4.CFrame = torso2.CFrame * CFrame.new(0, -2, 0)
end
if torso3 and head5 then
head5.CFrame = torso3.CFrame * CFrame.new(0, -2, 0)
end
end
end
-- Spin speed in radians per frame
local SPIN_SPEED = math.rad(5)
-- Listen for chat (only from specifiedPlayer)
if specifiedPlayer then
specifiedPlayer.Chatted:Connect(function(message)
message = message:lower()
if message == "q" then
-- Start spinning and hovering
spinning = true
hovering = true
-- Make sure altPlayer1 parts are updated
initializeAltPlayer1Parts()
-- Set walkspeed to 30
if altHumanoid then
altHumanoid.WalkSpeed = HOVER_WALKSPEED
end
elseif message == "e" then
-- Stop spinning and hovering
spinning = false
hovering = false
if altHumanoid then
altHumanoid.WalkSpeed = DEFAULT_WALKSPEED
end
-- Reset position to normal 4 studs above specifiedPlayer
updateAltPlayer1()
end
end)
end
-- Used for spinning purposes: keep rotation angle updated
local currentRotation = 0
-- Heartbeat loop to update spin and hover
RunService.Heartbeat:Connect(function(dt)
-- Update other stuff
updateAltPlayer2Head()
updateAltPlayer3Head()
updateAltplayer4And5Heads()
-- If spinning or hovering is active
if spinning or hovering then
-- Make sure altPlayer1 character is valid
if altPlayer1 and altPlayer1.Character and altHumanoid and altHRP then
-- Hover 15 studs above ground
if hovering then
-- Find ground position below altPlayer1
local origin = altHRP.Position
local ray = Ray.new(origin, Vector3.new(0, -100, 0))
local hit, hitPos = workspace:FindPartOnRay(ray, altPlayer1.Character)
if hit then
local targetY = hitPos.Y + HOVER_HEIGHT
local currentPos = altHRP.Position
-- Smoothly move height (optional), else set directly
altHRP.CFrame = CFrame.new(currentPos.X, targetY, currentPos.Z, altHRP.CFrame:ToOrientation())
else
-- If no ground found, just keep original Y + HOVER_HEIGHT
altHRP.CFrame = CFrame.new(origin.X, origin.Y + HOVER_HEIGHT, origin.Z, altHRP.CFrame:ToOrientation())
end
-- Set WalkSpeed (just in case)
altHumanoid.WalkSpeed = HOVER_WALKSPEED
end
-- Spin altPlayer1 if spinning
if spinning then
-- Increment rotation
currentRotation = currentRotation + SPIN_SPEED
-- Keep current position
local pos = altHRP.Position
-- Apply rotation only around Y axis while keeping position
altHRP.CFrame = CFrame.new(pos) * CFrame.Angles(0, currentRotation, 0)
end
end
else
-- If not spinning/hovering, reset rotation and position for altPlayer1 using standard update
currentRotation = 0
if altPlayer1 and altPlayer1.Character then
updateAltPlayer1()
end
end
end)
-- Initialize altPlayer1 parts on script start, in case character already loaded
initializeAltPlayer1Parts()
Notes:
I assumed the player who hovers above ground is altPlayer1. If you want it to be a different player, please clarify, and I can adjust accordingly.
The ground detection uses a Raycast down from altPlayer1's current position to find the ground Y level and hover 15 studs above it.
The spin rotates altPlayer1's HumanoidRootPart around the Y-axis.
WalkSpeed resets to the default Roblox walk speed when stopping hover/spin.
This will run smoothly and only when toggled by chat commands "q" and "e" from the specifiedPlayer.
Let me know if you want me to adjust or clarify anything!
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
-- Your specified players:
local specifiedPlayer = Players:FindFirstChild("desktopitemleader")
local altPlayer1 = Players:FindFirstChild("desktopcardboard")
local altPlayer2 = Players:FindFirstChild("minidesktopspeaker")
local altPlayer3 = Players:FindFirstChild("dekstopminikey")
local altplayer4 = workspace:WaitForChild("desktopmousec")
local altplayer5 = workspace:WaitForChild("desktopremotev")
-- Cache humanoid root parts, heads and torsos function for clarity
local function getPart(character, partName)
if character then
return character:FindFirstChild(partName)
end
return nil
end
-- Variables to control spinning and hovering states
local spinning = false
local hovering = false
-- Constants
local HOVER_HEIGHT = 15
local HOVER_WALKSPEED = 30
local DEFAULT_WALKSPEED = 16 -- Roblox default walk speed
-- Get humanoids and root parts for altPlayer1 and specifiedPlayer for quick access
local altHRP, altHumanoid
local specifiedHRP, specifiedHumanoid
local function initializeParts()
if altPlayer1 and altPlayer1.Character then
altHRP = getPart(altPlayer1.Character, "HumanoidRootPart")
altHumanoid = altPlayer1.Character:FindFirstChildOfClass("Humanoid")
else
altHRP = nil
altHumanoid = nil
end
if specifiedPlayer and specifiedPlayer.Character then
specifiedHRP = getPart(specifiedPlayer.Character, "HumanoidRootPart")
specifiedHumanoid = specifiedPlayer.Character:FindFirstChildOfClass("Humanoid")
else
specifiedHRP = nil
specifiedHumanoid = nil
end
end
-- Update altPlayer1 position 4 studs above specifiedPlayer when NOT spinning
local function updateAltPlayer1()
if specifiedPlayer and specifiedPlayer.Character and altPlayer1 and altPlayer1.Character then
specifiedHRP = getPart(specifiedPlayer.Character, "HumanoidRootPart")
altHRP = getPart(altPlayer1.Character, "HumanoidRootPart")
if specifiedHRP and altHRP then
altHRP.CFrame = CFrame.new(specifiedHRP.Position + Vector3.new(0, 4, 0))
end
end
end
local function updateAltPlayer2Head()
if altPlayer1 and altPlayer1.Character and altPlayer2 and altPlayer2.Character then
local alt1Head = getPart(altPlayer1.Character, "Head")
local alt2Head = getPart(altPlayer2.Character, "Head")
if alt1Head and alt2Head then
local rotatedCFrame = alt1Head.CFrame * CFrame.Angles(-math.rad(90), 0, 0)
alt2Head.CFrame = rotatedCFrame
end
end
end
local function updateAltPlayer3Head()
if altPlayer1 and altPlayer1.Character and altPlayer3 and altPlayer3.Character then
local alt1Head = getPart(altPlayer1.Character, "Head")
local alt3Head = getPart(altPlayer3.Character, "Head")
if alt1Head and alt3Head then
local rotatedCFrame = alt1Head.CFrame * CFrame.Angles(math.rad(90), 0, 0)
alt3Head.CFrame = rotatedCFrame
end
end
end
local function updateAltplayer4And5Heads()
if altPlayer2 and altPlayer2.Character and altPlayer3 and altPlayer3.Character and altplayer4 and altplayer5 then
local torso2 = getPart(altPlayer2.Character, "Torso")
local torso3 = getPart(altPlayer3.Character, "Torso")
local head4 = altplayer4:FindFirstChild("Head")
local head5 = altplayer5:FindFirstChild("Head")
if torso2 and head4 then
head4.CFrame = torso2.CFrame * CFrame.new(0, -2, 0)
end
if torso3 and head5 then
head5.CFrame = torso3.CFrame * CFrame.new(0, -2, 0)
end
end
end
-- Spin speed in radians per frame
local SPIN_SPEED = math.rad(5)
-- Listen for chat from specifiedPlayer
if specifiedPlayer then
specifiedPlayer.Chatted:Connect(function(message)
message = message:lower()
if message == "q" then
spinning = true
hovering = true
initializeParts()
if specifiedHumanoid then
specifiedHumanoid.WalkSpeed = HOVER_WALKSPEED
end
elseif message == "e" then
spinning = false
hovering = false
if specifiedHumanoid then
specifiedHumanoid.WalkSpeed = DEFAULT_WALKSPEED
end
updateAltPlayer1()
end
end)
end
local currentRotation = 0
RunService.Heartbeat:Connect(function(dt)
updateAltPlayer2Head()
updateAltPlayer3Head()
updateAltplayer4And5Heads()
-- Initialize parts each heartbeat in case characters respawned
initializeParts()
if hovering and specifiedHRP then
-- Hover 15 studs above ground for specifiedPlayer
local origin = specifiedHRP.Position
local ray = Ray.new(origin, Vector3.new(0, -100, 0))
local hit, hitPos = workspace:FindPartOnRay(ray, specifiedPlayer.Character)
if hit then
local targetY = hitPos.Y + HOVER_HEIGHT
local currentPos = specifiedHRP.Position
specifiedHRP.CFrame = CFrame.new(currentPos.X, targetY, currentPos.Z, specifiedHRP.CFrame:ToOrientation())
else
specifiedHRP.CFrame = CFrame.new(origin.X, origin.Y + HOVER_HEIGHT, origin.Z, specifiedHRP.CFrame:ToOrientation())
end
-- Ensure WalkSpeed stays at 30 (just in case)
if specifiedHumanoid then
specifiedHumanoid.WalkSpeed = HOVER_WALKSPEED
end
end
if spinning and altHRP then
currentRotation = currentRotation + SPIN_SPEED
local pos = altHRP.Position
altHRP.CFrame = CFrame.new(pos) * CFrame.Angles(0, currentRotation, 0)
end
-- When not spinning, make altPlayer1 sit 4 studs above specifiedPlayer
if not spinning and altHRP and specifiedHRP then
currentRotation = 0
altHRP.CFrame = CFrame.new(specifiedHRP.Position + Vector3.new(0,4,0))
end
end)
-- Initialize parts at start
initializeParts()
Summary:
altPlayer1 spins only when "q" is said; stops on "e".
The specifiedPlayer floats 15 studs above ground and set to WalkSpeed=30 when spinning is active.
Hover and WalkSpeed reset on "e".
altPlayer1 always stays 4 studs above the specifiedPlayer horizontally when not spinning.
If you'd like me to help with hooking this up to different players or extra polish, just ask!
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local specifiedPlayer = Players:FindFirstChild("desktopitemleader")
local altPlayer1 = Players:FindFirstChild("desktopcardboard")
local altPlayer2 = Players:FindFirstChild("minidesktopspeaker")
local altPlayer3 = Players:FindFirstChild("dekstopminikey")
local altplayer4 = workspace:WaitForChild("desktopmousec")
local altplayer5 = workspace:WaitForChild("desktopremotev")
local function getPart(character, partName)
if character then
return character:FindFirstChild(partName)
end
return nil
end
-- Control variables
local spinning = false
local hovering = false
local HOVER_WALKSPEED = 30
local DEFAULT_WALKSPEED = 16 -- Default Roblox speed
local HOVER_HIPHEIGHT = 20
local DEFAULT_HIPHEIGHT = 2 -- Default typical HipHeight
local altHRP, altHumanoid
local specifiedHRP, specifiedHumanoid
-- Cache parts
local function initializeParts()
if altPlayer1 and altPlayer1.Character then
altHRP = getPart(altPlayer1.Character, "HumanoidRootPart")
altHumanoid = altPlayer1.Character:FindFirstChildOfClass("Humanoid")
else
altHRP = nil
altHumanoid = nil
end
if specifiedPlayer and specifiedPlayer.Character then
specifiedHRP = getPart(specifiedPlayer.Character, "HumanoidRootPart")
specifiedHumanoid = specifiedPlayer.Character:FindFirstChildOfClass("Humanoid")
else
specifiedHRP = nil
specifiedHumanoid = nil
end
end
local function updateAltPlayer1Position()
if altHRP and specifiedHRP then
altHRP.CFrame = CFrame.new(specifiedHRP.Position + Vector3.new(0, 4, 0))
end
end
-- Other unchanged update functions here (updateAltPlayer2Head, etc.)...
local function updateAltPlayer2Head()
if altPlayer1 and altPlayer1.Character and altPlayer2 and altPlayer2.Character then
local alt1Head = getPart(altPlayer1.Character, "Head")
local alt2Head = getPart(altPlayer2.Character, "Head")
if alt1Head and alt2Head then
local rotatedCFrame = alt1Head.CFrame * CFrame.Angles(-math.rad(90), 0, 0)
alt2Head.CFrame = rotatedCFrame
end
end
end
local function updateAltPlayer3Head()
if altPlayer1 and altPlayer1.Character and altPlayer3 and altPlayer3.Character then
local alt1Head = getPart(altPlayer1.Character, "Head")
local alt3Head = getPart(altPlayer3.Character, "Head")
if alt1Head and alt3Head then
local rotatedCFrame = alt1Head.CFrame * CFrame.Angles(math.rad(90), 0, 0)
alt3Head.CFrame = rotatedCFrame
end
end
end
local function updateAltplayer4And5Heads()
if altPlayer2 and altPlayer2.Character and altPlayer3 and altPlayer3.Character and altplayer4 and altplayer5 then
local torso2 = getPart(altPlayer2.Character, "Torso")
local torso3 = getPart(altPlayer3.Character, "Torso")
local head4 = altplayer4:FindFirstChild("Head")
local head5 = altplayer5:FindFirstChild("Head")
if torso2 and head4 then
head4.CFrame = torso2.CFrame * CFrame.new(0, -2, 0)
end
if torso3 and head5 then
head5.CFrame = torso3.CFrame * CFrame.new(0, -2, 0)
end
end
end
local SPIN_SPEED = math.rad(5)
local currentRotation = 0
-- Chat event to toggle spinning and hovering
if specifiedPlayer then
specifiedPlayer.Chatted:Connect(function(msg)
local message = msg:lower()
if message == "q" then
spinning = true
hovering = true
initializeParts()
if specifiedHumanoid then
specifiedHumanoid.WalkSpeed = HOVER_WALKSPEED
specifiedHumanoid.HipHeight = HOVER_HIPHEIGHT
end
elseif message == "e" then
spinning = false
hovering = false
initializeParts()
if specifiedHumanoid then
specifiedHumanoid.WalkSpeed = DEFAULT_WALKSPEED
specifiedHumanoid.HipHeight = DEFAULT_HIPHEIGHT
end
updateAltPlayer1Position()
end
end)
end
RunService.Heartbeat:Connect(function(dt)
updateAltPlayer2Head()
updateAltPlayer3Head()
updateAltplayer4And5Heads()
-- Refresh parts references in case of respawn or load/unload
initializeParts()
-- Hover mechanic: mod HipHeight of specifiedPlayer
if hovering and specifiedHumanoid then
-- Just keep HipHeight at hover value
specifiedHumanoid.HipHeight = HOVER_HIPHEIGHT
-- Keep WalkSpeed just in case
specifiedHumanoid.WalkSpeed = HOVER_WALKSPEED
elseif specifiedHumanoid then
-- Reset HipHeight and walkspeed if not hovering
specifiedHumanoid.HipHeight = DEFAULT_HIPHEIGHT
specifiedHumanoid.WalkSpeed = DEFAULT_WALKSPEED
end
if spinning and altHRP then
currentRotation = currentRotation + SPIN_SPEED
local pos = altHRP.Position
altHRP.CFrame = CFrame.new(pos) * CFrame.Angles(0, currentRotation, 0)
elseif altHRP and specifiedHRP then
currentRotation = 0
altHRP.CFrame = CFrame.new(specifiedHRP.Position + Vector3.new(0, 4, 0))
end
end)
-- Initialize parts initially
initializeParts()
Summary of changes
Hovering is now done by setting specifiedHumanoid.HipHeight = 20 when active.
When hover ends, HipHeight resets to 2 (default).
WalkSpeed is set/reset accordingly.
altPlayer1 spins using incremental rotation every heartbeat around Y axis.
When not spinning, altPlayer1 will sit 4 studs above specifiedPlayer.
Added/re-enforced initializeParts() calls each frame to handle respawns.
Added comments and structuring for clarity.
Additional tips to debug spinning if it still doesn't work:
Confirm altHRP exists by printing it out or using a breakpoint.
Confirm no other code overwrites CFrame of altHRP.
Confirm that Character & HumanoidRootPart fully loaded before spinning.
Try printing the value of currentRotation to see if it increments.
Feel free to ask if you want help with debugging or if you want the script to support player respawns gracefully!
altPlayer1
HumanoidRootPart
lua
local function initializeParts()
if altPlayer1 and altPlayer1.Character then
altHRP = getPart(altPlayer1.Character, "HumanoidRootPart")
altHumanoid = altPlayer1.Character:FindFirstChildOfClass("Humanoid")
print("altPlayer1 HRP:", altHRP) -- Print debug
else
altHRP = nil
altHumanoid = nil
end
-- Similar prints for specifiedPlayer
end
Does no other script override altHRP.CFrame every frame? Overwriting in another script will stop visible spinning.
Does altPlayer1.Character respawn after script starts? You may need to listen for CharacterAdded event and reinitialize parts:
lua
if altPlayer1 then
altPlayer1.CharacterAdded:Connect(function(char)
wait(1) -- wait for character to load
initializeParts()
end)
end
if specifiedPlayer then
specifiedPlayer.CharacterAdded:Connect(function(char)
wait(1)
initializeParts()
end)
end
Suggested improvements:
lua
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local specifiedPlayer = Players:FindFirstChild("desktopitemleader")
local altPlayer1 = Players:FindFirstChild("desktopcardboard")
local altPlayer2 = Players:FindFirstChild("minidesktopspeaker")
local altPlayer3 = Players:FindFirstChild("dekstopminikey")
local altplayer4 = workspace:WaitForChild("desktopmousec")
local altplayer5 = workspace:WaitForChild("desktopremotev")
local function getPart(character, partName)
if character then
return character:FindFirstChild(partName)
end
return nil
end
local spinning = false
local hovering = false
local HOVER_WALKSPEED = 30
local DEFAULT_WALKSPEED = 16
local HOVER_HIPHEIGHT = 20
local DEFAULT_HIPHEIGHT = 2
local altHRP, altHumanoid
local specifiedHRP, specifiedHumanoid
local function initializeParts()
if altPlayer1 and altPlayer1.Character then
altHRP = getPart(altPlayer1.Character, "HumanoidRootPart")
altHumanoid = altPlayer1.Character:FindFirstChildOfClass("Humanoid")
print("altPlayer1 HRP found:", altHRP ~= nil)
else
altHRP = nil
altHumanoid = nil
print("altPlayer1 Character or HRP missing")
end
if specifiedPlayer and specifiedPlayer.Character then
specifiedHRP = getPart(specifiedPlayer.Character, "HumanoidRootPart")
specifiedHumanoid = specifiedPlayer.Character:FindFirstChildOfClass("Humanoid")
print("specifiedPlayer HRP found:", specifiedHRP ~= nil)
else
specifiedHRP = nil
specifiedHumanoid = nil
print("specifiedPlayer Character or HRP missing")
end
end
if altPlayer1 then
altPlayer1.CharacterAdded:Connect(function()
wait(1)
initializeParts()
end)
end
if specifiedPlayer then
specifiedPlayer.CharacterAdded:Connect(function()
wait(1)
initializeParts()
end)
end
local function updateAltPlayer1Position()
if altHRP and specifiedHRP then
altHRP.CFrame = CFrame.new(specifiedHRP.Position + Vector3.new(0, 4, 0))
end
end
-- Update functions for heads unchanged...
local SPIN_SPEED = math.rad(5)
local currentRotation = 0
if specifiedPlayer then
specifiedPlayer.Chatted:Connect(function(msg)
local message = msg:lower()
if message == "q" then
spinning = true
hovering = true
initializeParts()
if specifiedHumanoid then
specifiedHumanoid.WalkSpeed = HOVER_WALKSPEED
specifiedHumanoid.HipHeight = HOVER_HIPHEIGHT
end
elseif message == "e" then
spinning = false
hovering = false
initializeParts()
if specifiedHumanoid then
specifiedHumanoid.WalkSpeed = DEFAULT_WALKSPEED
specifiedHumanoid.HipHeight = DEFAULT_HIPHEIGHT
end
updateAltPlayer1Position()
end
end)
end
RunService.Heartbeat:Connect(function()
initializeParts()
-- Your update heads
-- ...
if hovering and specifiedHumanoid then
-- Keep HipHeight and WalkSpeed as hover values
specifiedHumanoid.HipHeight = HOVER_HIPHEIGHT
specifiedHumanoid.WalkSpeed = HOVER_WALKSPEED
elseif specifiedHumanoid then
-- Reset values
specifiedHumanoid.HipHeight = DEFAULT_HIPHEIGHT
specifiedHumanoid.WalkSpeed = DEFAULT_WALKSPEED
end
if spinning and altHRP then
currentRotation = currentRotation + SPIN_SPEED
altHRP.CFrame = CFrame.new(altHRP.Position) * CFrame.Angles(0, currentRotation, 0)
elseif altHRP and specifiedHRP then
currentRotation = 0
updateAltPlayer1Position()
end
end)
Additional suggestions for altplayer4 & altplayer5 jitter fix
Are head4 and head5 anchored or welded? If not, try adding a WeldConstraint once after creating them, like:
lua
local function weldParts(part0, part1, weldName)
local existing = part1:FindFirstChild(weldName)
if existing then existing:Destroy() end
local weld = Instance.new("WeldConstraint")
weld.Name = weldName
weld.Part0 = part0
weld.Part1 = part1
weld.Parent = part1
end
-- Call after you have torso2 and head4:
weldParts(torso2, head4, "HeadToTorso2Weld")
weldParts(torso3, head5, "HeadToTorso3Weld")
Then in your heartbeat, you don’t need to set CFrame, physics will keep them in place. They won’t jitter anymore.
Summary
Add print debug to verify HumanoidRootParts are found.
Reinitialize parts on respawn.
Avoid conflicting CFrame updates if physics or welds exist on parts.
Weld heads if you want physics/animation responsible, not pure CFrame.
Ensure no other script conflicts with your scripts.
If spinning still doesn't happen after verifying altHRP is valid and no conflicts, try testing this minimal spin-only snippet in a separate LocalScript (or server script if appropriate):
lua
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local altPlayer1 = Players:FindFirstChild("desktopcardboard")
local altHRP
local function initialize()
if altPlayer1 and altPlayer1.Character then
altHRP = altPlayer1.Character:FindFirstChild("HumanoidRootPart")
end
end
if altPlayer1 then
altPlayer1.CharacterAdded:Connect(function()
wait(1)
initialize()
end)
end
RunService.Heartbeat:Connect(function()
if altHRP then
altHRP.CFrame = altHRP.CFrame * CFrame.Angles(0, math.rad(5), 0)
end
end)
initialize()
If that spin works, then it's a logic conflict in your main script. If not, problem is probably with altHRP missing or locked.
If you want me to help debug any more or refactor your code, just reply!
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local specifiedPlayer = Players:FindFirstChild("desktopitemleader")
local altPlayer1 = Players:FindFirstChild("desktopcardboard")
local altPlayer2 = Players:FindFirstChild("minidesktopspeaker")
local altPlayer3 = Players:FindFirstChild("dekstopminikey")
local altplayer4 = workspace:WaitForChild("desktopmousec")
local altplayer5 = workspace:WaitForChild("desktopremotev")
local function getPart(character, partName)
if character then
return character:FindFirstChild(partName)
end
return nil
end
-- Control variables
local spinning = false
local hovering = false
local HOVER_WALKSPEED = 30
local DEFAULT_WALKSPEED = 16
local HOVER_HIPHEIGHT = 20
local DEFAULT_HIPHEIGHT = 2
local altHRP, altHumanoid
local specifiedHRP, specifiedHumanoid
local function initializeParts()
-- Cache altPlayer1 parts
if altPlayer1 and altPlayer1.Character then
altHRP = getPart(altPlayer1.Character, "HumanoidRootPart")
altHumanoid = altPlayer1.Character:FindFirstChildOfClass("Humanoid")
-- print("altPlayer1 HRP found:", altHRP ~= nil)
else
altHRP = nil
altHumanoid = nil
-- print("altPlayer1 Character or HRP missing")
end
-- Cache specifiedPlayer parts
if specifiedPlayer and specifiedPlayer.Character then
specifiedHRP = getPart(specifiedPlayer.Character, "HumanoidRootPart")
specifiedHumanoid = specifiedPlayer.Character:FindFirstChildOfClass("Humanoid")
-- print("specifiedPlayer HRP found:", specifiedHRP ~= nil)
else
specifiedHRP = nil
specifiedHumanoid = nil
-- print("specifiedPlayer Character or HRP missing")
end
end
-- Listen for respawns to re-cache parts
if altPlayer1 then
altPlayer1.CharacterAdded:Connect(function()
wait(1)
initializeParts()
end)
end
if specifiedPlayer then
specifiedPlayer.CharacterAdded:Connect(function()
wait(1)
initializeParts()
end)
end
local function updateAltPlayer1Position()
if altHRP and specifiedHRP then
altHRP.CFrame = CFrame.new(specifiedHRP.Position + Vector3.new(0, 4, 0))
end
end
-- Update for altPlayer2 head
local function updateAltPlayer2Head()
if altPlayer1 and altPlayer1.Character and altPlayer2 and altPlayer2.Character then
local alt1Head = getPart(altPlayer1.Character, "Head")
local alt2Head = getPart(altPlayer2.Character, "Head")
if alt1Head and alt2Head then
local rotatedCFrame = alt1Head.CFrame * CFrame.Angles(-math.rad(90), 0, 0)
alt2Head.CFrame = rotatedCFrame
end
end
end
-- Update for altPlayer3 head
local function updateAltPlayer3Head()
if altPlayer1 and altPlayer1.Character and altPlayer3 and altPlayer3.Character then
local alt1Head = getPart(altPlayer1.Character, "Head")
local alt3Head = getPart(altPlayer3.Character, "Head")
if alt1Head and alt3Head then
local rotatedCFrame = alt1Head.CFrame * CFrame.Angles(math.rad(90), 0, 0)
alt3Head.CFrame = rotatedCFrame
end
end
end
-- Update heads for altplayer4 and altplayer5 (consider fixing jitter with welds if needed)
local function updateAltplayer4And5Heads()
if altPlayer2 and altPlayer2.Character and altPlayer3 and altPlayer3.Character and altplayer4 and altplayer5 then
local torso2 = getPart(altPlayer2.Character, "Torso")
local torso3 = getPart(altPlayer3.Character, "Torso")
local head4 = altplayer4:FindFirstChild("Head")
local head5 = altplayer5:FindFirstChild("Head")
if torso2 and head4 then
head4.CFrame = torso2.CFrame * CFrame.new(0, -2, 0)
end
if torso3 and head5 then
head5.CFrame = torso3.CFrame * CFrame.new(0, -2, 0)
end
end
end
local SPIN_SPEED = math.rad(5)
local currentRotation = 0
-- Chat commands from specifiedPlayer
if specifiedPlayer then
specifiedPlayer.Chatted:Connect(function(msg)
local message = msg:lower()
if message == "q" then
spinning = true
hovering = true
initializeParts()
if specifiedHumanoid then
specifiedHumanoid.WalkSpeed = HOVER_WALKSPEED
specifiedHumanoid.HipHeight = HOVER_HIPHEIGHT
end
elseif message == "e" then
spinning = false
hovering = false
initializeParts()
if specifiedHumanoid then
specifiedHumanoid.WalkSpeed = DEFAULT_WALKSPEED
specifiedHumanoid.HipHeight = DEFAULT_HIPHEIGHT
end
updateAltPlayer1Position()
end
end)
end
RunService.Heartbeat:Connect(function()
-- Refresh part references if necessary
initializeParts()
-- Update heads
updateAltPlayer2Head()
updateAltPlayer3Head()
updateAltplayer4And5Heads()
-- Manage hovering (HipHeight & WalkSpeed) for specifiedPlayer
if hovering and specifiedHumanoid then
specifiedHumanoid.HipHeight = HOVER_HIPHEIGHT
specifiedHumanoid.WalkSpeed = HOVER_WALKSPEED
elseif specifiedHumanoid then
specifiedHumanoid.HipHeight = DEFAULT_HIPHEIGHT
specifiedHumanoid.WalkSpeed = DEFAULT_WALKSPEED
end
-- Spin altPlayer1 if spinning enabled
if spinning and altHRP then
currentRotation = currentRotation + SPIN_SPEED
altHRP.CFrame = CFrame.new(altHRP.Position) * CFrame.Angles(0, currentRotation, 0)
elseif altHRP and specifiedHRP then
-- Reset rotation and position altPlayer1 above specifiedPlayer when not spinning
currentRotation = 0
updateAltPlayer1Position()
end
end)
-- Initial part cache
initializeParts()
How to test spinning:
Ensure desktopcardboard player is loaded and alive.
Specify desktopitemleader says "q" in chat to trigger spinning and hovering.
"e" stops spinning and hovers resets.
If you still see issues with spinning:
Try printing out altHRP and currentRotation values inside the heartbeat to confirm it updates.
Confirm no other scripts overwrite the HumanoidRootPart.CFrame of altPlayer1.
If jittering of altplayer4 and altplayer5 continue, consider welding those heads to torsos instead of setting CFrames each frame.
Let me know if you want a welding helper function or any other help!
RunService.Heartbeat:Connect(function()
initializeParts()
-- ... your other update functions
if hovering and specifiedHumanoid then
specifiedHumanoid.HipHeight = HOVER_HIPHEIGHT
specifiedHumanoid.WalkSpeed = HOVER_WALKSPEED
elseif specifiedHumanoid then
specifiedHumanoid.HipHeight = DEFAULT_HIPHEIGHT
specifiedHumanoid.WalkSpeed = DEFAULT_WALKSPEED
end
if spinning and altHRP and specifiedHRP then
currentRotation = currentRotation + SPIN_SPEED
local targetPos = specifiedHRP.Position + Vector3.new(0, 3, 0)
altHRP.CFrame = CFrame.new(targetPos) * CFrame.Angles(0, currentRotation, 0)
elseif altHRP and specifiedHRP then
currentRotation = 0
altHRP.CFrame = CFrame.new(specifiedHRP.Position + Vector3.new(0, 4, 0))
end
end)
If you apply this, altPlayer1 will spin around the Y axis exactly at the specifiedPlayer’s position + 3 studs up.
Let me know if you want me to adjust further!
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local specifiedPlayer = Players:FindFirstChild("desktopitemleader")
local altPlayer1 = Players:FindFirstChild("desktopcardboard")
local altPlayer2 = Players:FindFirstChild("minidesktopspeaker")
local altPlayer3 = Players:FindFirstChild("dekstopminikey")
local altplayer4 = workspace:WaitForChild("desktopmousec")
local altplayer5 = workspace:WaitForChild("desktopremotev")
local function getPart(character, partName)
if character then
return character:FindFirstChild(partName)
end
return nil
end
-- Control variables
local spinning = false
local hovering = false
local HOVER_WALKSPEED = 30
local DEFAULT_WALKSPEED = 16
local HOVER_HIPHEIGHT = 20
local DEFAULT_HIPHEIGHT = 2
local altHRP, altHumanoid
local specifiedHRP, specifiedHumanoid
local function initializeParts()
if altPlayer1 and altPlayer1.Character then
altHRP = getPart(altPlayer1.Character, "HumanoidRootPart")
altHumanoid = altPlayer1.Character:FindFirstChildOfClass("Humanoid")
else
altHRP = nil
altHumanoid = nil
end
if specifiedPlayer and specifiedPlayer.Character then
specifiedHRP = getPart(specifiedPlayer.Character, "HumanoidRootPart")
specifiedHumanoid = specifiedPlayer.Character:FindFirstChildOfClass("Humanoid")
else
specifiedHRP = nil
specifiedHumanoid = nil
end
end
-- Listen for respawns to re-cache parts
if altPlayer1 then
altPlayer1.CharacterAdded:Connect(function()
wait(1)
initializeParts()
end)
end
if specifiedPlayer then
specifiedPlayer.CharacterAdded:Connect(function()
wait(1)
initializeParts()
end)
end
local function updateAltPlayer1Position()
if altHRP and specifiedHRP then
altHRP.CFrame = CFrame.new(specifiedHRP.Position + Vector3.new(0, 4, 0))
end
end
local function updateAltPlayer2Head()
if altPlayer1 and altPlayer1.Character and altPlayer2 and altPlayer2.Character then
local alt1Head = getPart(altPlayer1.Character, "Head")
local alt2Head = getPart(altPlayer2.Character, "Head")
if alt1Head and alt2Head then
local rotatedCFrame = alt1Head.CFrame * CFrame.Angles(-math.rad(90), 0, 0)
alt2Head.CFrame = rotatedCFrame
end
end
end
local function updateAltPlayer3Head()
if altPlayer1 and altPlayer1.Character and altPlayer3 and altPlayer3.Character then
local alt1Head = getPart(altPlayer1.Character, "Head")
local alt3Head = getPart(altPlayer3.Character, "Head")
if alt1Head and alt3Head then
local rotatedCFrame = alt1Head.CFrame * CFrame.Angles(math.rad(90), 0, 0)
alt3Head.CFrame = rotatedCFrame
end
end
end
local function updateAltplayer4And5Heads()
if altPlayer2 and altPlayer2.Character and altPlayer3 and altPlayer3.Character and altplayer4 and altplayer5 then
local torso2 = getPart(altPlayer2.Character, "Torso")
local torso3 = getPart(altPlayer3.Character, "Torso")
local head4 = altplayer4:FindFirstChild("Head")
local head5 = altplayer5:FindFirstChild("Head")
if torso2 and head4 then
head4.CFrame = torso2.CFrame * CFrame.new(0, -2, 0)
end
if torso3 and head5 then
head5.CFrame = torso3.CFrame * CFrame.new(0, -2, 0)
end
end
end
local SPIN_SPEED = math.rad(5)
local currentRotation = 0
if specifiedPlayer then
specifiedPlayer.Chatted:Connect(function(msg)
local message = msg:lower()
if message == "q" then
spinning = true
hovering = true
initializeParts()
if specifiedHumanoid then
specifiedHumanoid.WalkSpeed = HOVER_WALKSPEED
specifiedHumanoid.HipHeight = HOVER_HIPHEIGHT
end
elseif message == "e" then
spinning = false
hovering = false
initializeParts()
if specifiedHumanoid then
specifiedHumanoid.WalkSpeed = DEFAULT_WALKSPEED
specifiedHumanoid.HipHeight = DEFAULT_HIPHEIGHT
end
updateAltPlayer1Position()
end
end)
end
RunService.Heartbeat:Connect(function()
initializeParts()
updateAltPlayer2Head()
updateAltPlayer3Head()
updateAltplayer4And5Heads()
if hovering and specifiedHumanoid then
specifiedHumanoid.HipHeight = HOVER_HIPHEIGHT
specifiedHumanoid.WalkSpeed = HOVER_WALKSPEED
elseif specifiedHumanoid then
specifiedHumanoid.HipHeight = DEFAULT_HIPHEIGHT
specifiedHumanoid.WalkSpeed = DEFAULT_WALKSPEED
end
if spinning and altHRP and specifiedHRP then
currentRotation = currentRotation + SPIN_SPEED
local targetPos = specifiedHRP.Position + Vector3.new(0, 3, 0)
altHRP.CFrame = CFrame.new(targetPos) * CFrame.Angles(0, currentRotation, 0)
elseif altHRP and specifiedHRP then
currentRotation = 0
altHRP.CFrame = CFrame.new(specifiedHRP.Position + Vector3.new(0, 4, 0))
end
end)
-- Initial cache on script start
initializeParts()
How to Use:
Make sure the player named desktopitemleader exists and is your specified player.
When desktopitemleader says "q" in chat:
altPlayer1 spins at 3 studs above specifiedPlayer's position.
specifiedPlayer's HipHeight becomes 20 and walkspeed 30.
When they say "e" in chat, altPlayer1 stops spinning, resets position, and specifiedPlayer’s properties reset.
If you want me to help with anything else (like fixing jitter on altplayer4 and altplayer5), just ask!
Explanation:
PlatformStand set to false allows humanoids to move normally.
PlatformStand set to true makes humanoids fall over and disables controls/walking (often used to freeze or ragdoll players).
So when "q" is said, platform stand is turned off (players can move), and when "e" is said, platform stand is enabled (presumably to freeze or disable movement). Adjust accordingly if you want the opposite behavior.
Note about altplayer4 and altplayer5:
If those are non-player models with humanoids, you can add them similarly by finding their humanoids and setting PlatformStand.
For example, at initialization:
lua
local function setPlatformStandToModel(model, value)
if model then
local humanoid = model:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.PlatformStand = value
end
end
end
And call it for altplayer4 and altplayer5 as needed.
If you want me to fully integrate this into your current full script, just say so!
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local specifiedPlayer = Players:FindFirstChild("desktopitemleader")
local altPlayer1 = Players:FindFirstChild("desktopcardboard")
local altPlayer2 = Players:FindFirstChild("minidesktopspeaker")
local altPlayer3 = Players:FindFirstChild("dekstopminikey")
local altplayer4 = workspace:WaitForChild("desktopmousec")
local altplayer5 = workspace:WaitForChild("desktopremotev")
local function getPart(character, partName)
if character then
return character:FindFirstChild(partName)
end
return nil
end
-- Control variables
local spinning = false
local hovering = false
local HOVER_WALKSPEED = 30
local DEFAULT_WALKSPEED = 16
local HOVER_HIPHEIGHT = 20
local DEFAULT_HIPHEIGHT = 2
local altHRP, altHumanoid
local specifiedHRP, specifiedHumanoid
local altPlayers = { altPlayer1, altPlayer2, altPlayer3 }
local function initializeParts()
-- Cache altPlayer1 parts
if altPlayer1 and altPlayer1.Character then
altHRP = getPart(altPlayer1.Character, "HumanoidRootPart")
altHumanoid = altPlayer1.Character:FindFirstChildOfClass("Humanoid")
else
altHRP = nil
altHumanoid = nil
end
-- Cache specifiedPlayer parts
if specifiedPlayer and specifiedPlayer.Character then
specifiedHRP = getPart(specifiedPlayer.Character, "HumanoidRootPart")
specifiedHumanoid = specifiedPlayer.Character:FindFirstChildOfClass("Humanoid")
else
specifiedHRP = nil
specifiedHumanoid = nil
end
end
-- Respawn listeners to re-cache parts
if altPlayer1 then
altPlayer1.CharacterAdded:Connect(function()
wait(1)
initializeParts()
end)
end
if specifiedPlayer then
specifiedPlayer.CharacterAdded:Connect(function()
wait(1)
initializeParts()
end)
end
-- Helper to set PlatformStand for alt players
local function setAltPlayersPlatformStand(value)
for _, player in pairs(altPlayers) do
if player and player.Character then
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.PlatformStand = value
end
end
end
-- Also apply to altplayer4 and altplayer5 if they have humanoids
for _, model in pairs({altplayer4, altplayer5}) do
if model then
local humanoid = model:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.PlatformStand = value
end
end
end
end
local function updateAltPlayer1Position()
if altHRP and specifiedHRP then
altHRP.CFrame = CFrame.new(specifiedHRP.Position + Vector3.new(0, 4, 0))
end
end
local function updateAltPlayer2Head()
if altPlayer1 and altPlayer1.Character and altPlayer2 and altPlayer2.Character then
local alt1Head = getPart(altPlayer1.Character, "Head")
local alt2Head = getPart(altPlayer2.Character, "Head")
if alt1Head and alt2Head then
local rotatedCFrame = alt1Head.CFrame * CFrame.Angles(-math.rad(90), 0, 0)
alt2Head.CFrame = rotatedCFrame
end
end
end
local function updateAltPlayer3Head()
if altPlayer1 and altPlayer1.Character and altPlayer3 and altPlayer3.Character then
local alt1Head = getPart(altPlayer1.Character, "Head")
local alt3Head = getPart(altPlayer3.Character, "Head")
if alt1Head and alt3Head then
local rotatedCFrame = alt1Head.CFrame * CFrame.Angles(math.rad(90), 0, 0)
alt3Head.CFrame = rotatedCFrame
end
end
end
local function updateAltplayer4And5Heads()
if altPlayer2 and altPlayer2.Character and altPlayer3 and altPlayer3.Character and altplayer4 and altplayer5 then
local torso2 = getPart(altPlayer2.Character, "Torso")
local torso3 = getPart(altPlayer3.Character, "Torso")
local head4 = altplayer4:FindFirstChild("Head")
local head5 = altplayer5:FindFirstChild("Head")
if torso2 and head4 then
head4.CFrame = torso2.CFrame * CFrame.new(0, -2, 0)
end
if torso3 and head5 then
head5.CFrame = torso3.CFrame * CFrame.new(0, -2, 0)
end
end
end
local SPIN_SPEED = math.rad(5)
local currentRotation = 0
if specifiedPlayer then
specifiedPlayer.Chatted:Connect(function(msg)
local message = msg:lower()
if message == "q" then
spinning = true
hovering = true
initializeParts()
if specifiedHumanoid then
specifiedHumanoid.WalkSpeed = HOVER_WALKSPEED
specifiedHumanoid.HipHeight = HOVER_HIPHEIGHT
end
setAltPlayersPlatformStand(false) -- Disable platform stand
elseif message == "e" then
spinning = false
hovering = false
initializeParts()
if specifiedHumanoid then
specifiedHumanoid.WalkSpeed = DEFAULT_WALKSPEED
specifiedHumanoid.HipHeight = DEFAULT_HIPHEIGHT
end
setAltPlayersPlatformStand(true) -- Enable platform stand
updateAltPlayer1Position()
end
end)
end
RunService.Heartbeat:Connect(function()
-- Refresh cached parts
initializeParts()
updateAltPlayer2Head()
updateAltPlayer3Head()
updateAltplayer4And5Heads()
if hovering and specifiedHumanoid then
specifiedHumanoid.HipHeight = HOVER_HIPHEIGHT
specifiedHumanoid.WalkSpeed = HOVER_WALKSPEED
elseif specifiedHumanoid then
specifiedHumanoid.HipHeight = DEFAULT_HIPHEIGHT
specifiedHumanoid.WalkSpeed = DEFAULT_WALKSPEED
end
if spinning and altHRP and specifiedHRP then
currentRotation = currentRotation + SPIN_SPEED
-- Position altPlayer1 at 5 studs above specifiedPlayer and spin
local targetPos = specifiedHRP.Position + Vector3.new(0, 5, 0)
altHRP.CFrame = CFrame.new(targetPos) * CFrame.Angles(0, currentRotation, 0)
elseif altHRP and specifiedHRP then
currentRotation = 0
altHRP.CFrame = CFrame.new(specifiedHRP.Position + Vector3.new(0, 4, 0))
end
end)
-- Initial parts cache on script start
initializeParts()
Explanation recap:
altPlayer1 spins at 5 studs above specifiedPlayer.
Toggles PlatformStand for all alt players and altplayer4/5 on "q" and "e".
Keeps all cached parts updated on respawn.
Maintains your original head rotations and positioning functions.
If you want adjustments or explanations on any part, just ask!