Client vs Server Visual Glitch

I have created a model that is simply welded together. When the game starts/run, The welded model on the client side appears misaligned and messed up. On the server-side, the model appears normal as it should be.

In the pictures, the left model is anchored with no script interference, and the right model is the welded model.
This is what the server-side Sees:


This is what the client-side sees:

I have tried starting a local server with 4 client players all seeing the same bugged while the server sees the normal one.
I have also tried restarting Studio but I have no idea what would cause this problem or even a solution to this.
Any help is appreciated Thanks!

This seems to have something to do with the way your weld script is orientating the rope parts, could you provide more information on the location of the weld script as well as snippets of the code to help you debug the issue.

Yes, it all starts anchored than is all unanchored after welded.

This is the layout but all the parts never fit on the page

This I assume is on the server side correct?

This is with the rope grouped so easier to see

Okay I didn’t have a clear look at the code above, but I assume it is probably an issue with some sort of delay in the script.
Here is my foolproof quickWelder that I’ve written years ago, should still work fine and I’ve already published it to the public if anyone wants to take it then I’ll leave a link below.

function createWeld(handle, p)
local weld = Instance.new('Weld')
weld.Part0 = handle
weld.Part1 = p
local c = CFrame.new(handle.Position)
local c0 = handle.CFrame:Inverse()*c
local c1 = p.CFrame:Inverse()*c
weld.C0 = c0
weld.C1 = c1
weld.Parent = p
end

for _, p in pairs(script.Parent:GetChildren()) do
	if p:IsA('BasePart') or p:IsA('Part') and p.Name ~= 'handle' then
		createWeld(script.Parent.Handle, p) -- Replace script.Parent.Handle with any other primarypart and put     this inside a model that you want to weld
	p.Anchored = false
end
end

script.Parent.Handle.Anchored = false

Also to add to that, meshparts and unionoperations have different classnames so you might want to add extra IsA arguments to that.

I think I may have gotten deleted while I tried to indent it sorry, but here it is again:
‘’’
local cannon = script.Parent
local primarypart = cannon.PrimaryPart
primarypart.Anchored = true
local parts = cannon:GetChildren() for i = 1, #parts do
if parts[i]:IsA(‘BasePart’) then
local weld = Instance.new(“Weld”)
weld.Part0 = primarypart
weld.Part1 = parts[i]
weld.C0 = primarypart.CFrame:inverse()
weld.C1 = parts[i].CFrame:inverse()
weld.Parent = primarypart
end
end
for i = 1, #parts do
if parts[i]:IsA(‘BasePart’) then
local weld = Instance.new(“Weld”)
parts[i].Anchored = false
primarypart.Anchored = false
end
end
‘’’

I will try the fool proof script

I changed it a bit to this

‘’’
function createWeld(handle, p)
local weld = Instance.new(‘Weld’)
weld.Part0 = handle
weld.Part1 = p
local c = CFrame.new(handle.Position)
local c0 = handle.CFrame:Inverse()*c
print(p)–Printed nil
local c1 = p.CFrame:Inverse()*c
weld.C0 = c0
weld.C1 = c1
weld.Parent = p
end
for _, p in pairs(script.Parent:GetChildren()) do
print(p)–Printed Part
if p:IsA(‘BasePart’) or p:IsA(‘Part’) or p:IsA(‘MeshPart’) and p.Name ~= ‘handle’ then
createWeld(script.Parent.Base)
p.Anchored = false
end
end
script.Parent.Handle.Anchored = false
‘’’
But it errored:
[10:32:00.153 - Workspace.Displays.Cannon1t.Weldt:7: attempt to index local ‘p’ (a nil value)]
10:32:00.154 - Stack Begin
[10:32:00.154 - Script ‘Workspace.Displays.Cannon1t.Weldt’, Line 7 - global createWeld]
[10:32:00.155 - Script ‘Workspace.Displays.Cannon1t.Weldt’, Line 16]
10:32:00.155 - Stack End

I think the Variable P is passed along to the upper function

Here is the indentation, idk why it doesn’t format properly

It needs a primary part (handle) that the weld will be C0’d to and a p.

Change “createWeld(script.Parent.Base)” to “createWeld(script.Parent.Base, p)”

Thanks, i did not think the script would be the solution

1 Like

It is a good practice whenever you are modifying a part to ensure that it is anchored to prevent it from being offset or misaligned while it is moved. Either way happy to help!

Please format your code in a code block using ```lua. Make sure to indent so others can understand it easier too.

--Like this example code:
script.Parent.CanCollide = false
local Block = script.Parent

while Block.CanCollide = false do
     Block.Transparency = 0.5
else
     warn("CanCollide is set to true.")