When using a WeldConstraint to weld a model to the player, the player is welded to the model instead

As the title explains, no matter what I do with the welds (i have swapped the order numerous times) the player is welded directly onto the model.

I made the model not anchored and removed collisions, but any time I edit that either the same problem arrives.

Here is the code:

local player = game.Players.LocalPlayer
local guy = workspace.guy 
local character = player.Character or player.CharacterAdded:Wait()

for i, v in pairs(guy:GetChildren()) do
	if v:IsA("MeshPart") or v:IsA("Part") then
		local awesomeWeld = Instance.new("WeldConstraint", v)
		awesomeWeld.Part0 = v
		awesomeWeld.Part1 = guy.PrimaryPart
	end
end
task.wait()
guy:PivotTo(character.PrimaryPart.CFrame)
task.wait()
local weld = Instance.new("WeldConstraint")
weld.Part0 = guy.PrimaryPart
weld.Part1 = character.PrimaryPart
weld.Parent = guy
guy.Parent = character
2 Likes

try making the parts inside the model maseless

2 Likes

This worked, but then the model gets deleted after a few seconds, I assume part of this is because on top of being welded, it is probably constantly falling as well

1 Like

if parts inside the model get deleted the model remains but empty, its some script deleting i assume

1 Like

There’s no other script, this is the one script, the model gets completely removed, I think it somehow is falling under the map despite being welded

1 Like

Your script is a local script, so the weld is only being created on the client. Generally, when you want to weld something to the player that exists on the server (i.e. not a local part), you have to create the weld on the server and let it replicate to the client. Otherwise, the part’s not actually welded on the server so it can fall out of the world and despawn, which will replicate to all clients.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.