I was just messing around trying to make a balloon tween and fly around but encountered this wacky bug, all the parts are unanchored and welded to a single anchored part that is tweened to fly around in a serverside script inside of it, on clientside everything seems fine, but on serverside all the unanchored welded parts don’t move…
local part = script.Parent
local balloon = script.Parent.Parent.Balloon
local TweenService = game:GetService("TweenService")
local baseY = 140
local model = script.Parent.Parent
local function float(Speed, floatingRange)
local newY = part.Position.Y + math.random(-floatingRange, floatingRange)
if newY < baseY - floatingRange then
newY = baseY + floatingRange
elseif newY > baseY + floatingRange then
newY = baseY - floatingRange
end
local newPosition = Vector3.new(part.Position.X + math.random(-floatingRange, floatingRange), newY, part.Position.Z + math.random(-floatingRange, floatingRange))
local rotationAngle = math.random(-180, 180)
local newOrientation = part.Orientation + Vector3.new(0, rotationAngle, 0)
local tweenInfo = TweenInfo.new(Speed,
Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, true
)
local positionTween = TweenService:Create(part, tweenInfo, {Position = newPosition})
local rotationTween = TweenService:Create(part, tweenInfo, {Orientation = newOrientation})
positionTween:Play()
rotationTween:Play()
end
while true do
local Speed = math.random(3,6)
local floatingRange = math.random(25,100)
float(Speed, floatingRange)
task.wait(Speed)
end
And here’s what it looks like in a 2 player server test…
The player is continuously trying to spawn on a spawn point that isn’t there locally…
I also tried setting the network ownership of all the parts to nil, only for no change.
When you’re tweening an anchored part (the main part that is welded to the other unanchored parts), the physics of the welded, unanchored parts might not update on the server properly because the server doesn’t simulate physics for anchored parts in the same way it does for unanchored parts.
When you use the Position property for tweening an anchored part, it might not trigger physics for the unanchored parts correctly. Instead, you should use CFrame for the movement. CFrame ensures that both the position and rotation are accounted for, and it can propagate the movement through the welds better.
local part = script.Parent
local balloon = script.Parent.Parent.Balloon
local TweenService = game:GetService("TweenService")
local baseY = 140 -- Base Y position
local model = script.Parent.Parent
local function float(Speed, floatingRange)
local newY = part.Position.Y + math.random(-floatingRange, floatingRange)
if newY < baseY - floatingRange then
newY = baseY + floatingRange
elseif newY > baseY + floatingRange then
newY = baseY - floatingRange
end
local newPosition = Vector3.new(part.Position.X + math.random(-floatingRange, floatingRange), newY, part.Position.Z + math.random(-floatingRange, floatingRange))
local rotationAngle = math.random(-180, 180)
local newOrientation = part.Orientation + Vector3.new(0, rotationAngle, 0)
-- Create the new CFrame for the position and orientation
local newCFrame = CFrame.new(newPosition) * CFrame.Angles(0, math.rad(rotationAngle), 0)
-- Tween using CFrame instead of Position and Orientation
local tweenInfo = TweenInfo.new(Speed, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, true)
local cframeTween = TweenService:Create(part, tweenInfo, {CFrame = newCFrame})
-- Play the CFrame tween
cframeTween:Play()
end
while true do
local Speed = math.random(3,6)
local floatingRange = math.random(25,100)
float(Speed, floatingRange)
task.wait(Speed)
end
Welded parts respect the CFrame of their parent part, which ensures they move and rotate correctly along with the anchored part.
When you’re tweening Position and Orientation separately, it can sometimes cause synchronization issues with physics replication between the server and client. Using CFrame avoids this.
It’s hard to tell for sure without messing with the model myself to troubleshoot, but my guess is it has something to do with Network Ownership or some other odd desync with the physics. Is your script a Local Script or a Server Script? Server Script would be required for this.