Error with weld

welll, I have a little problem with welds and that is that when they are created and hooked (the character is hooked with a part), the character teleports to the parts when the parts must be teleported with the welds. I honestly don’t know what the problem is.

local function createObject(class, properties, parent)
local obj = Instance.new(class)
for i,v in pairs(properties) do
obj[i] = v
end
obj.Parent = parent
return obj
end

local Head = game.Players.LocalPlayer.Character:WaitForChild("Head")
local Transparency = 0.5

local FolderParts = Instance.new("Folder")
FolderParts.Name = "CamParts"
FolderParts.Parent = workspace

local Parts = {
OnePart = createObject("Part",{CanCollide = false,Transparency = Transparency,Anchored=true}, FolderParts),
TwoPart = createObject("Part",{CanCollide = false,Transparency = Transparency,Anchored=true}, FolderParts),
ThreePart = createObject("Part",{CanCollide = false,Transparency = Transparency,Anchored=true}, FolderParts),
FourPart = createObject("Part",{CanCollide = false,Transparency = Transparency,Anchored=true}, FolderParts),
}


local Welds = {
OneWeld = createObject("Weld",{Part0 = Head, Part1 = Parts.OnePart, C0 = CFrame.new(0,200,0)}, Parts.OnePart),
TwoWeld = createObject("Weld",{Part0 = Head, Part1 = Parts.TwoPart, C0 = CFrame.new(0,100,0)}, Parts.TwoPart),
ThreeWeld = createObject("Weld",{Part0 = Head, Part1 = Parts.ThreePart, C0 = CFrame.new(0,15,0)}, Parts.ThreePart),
FourWeld =createObject("Weld",{Part0 = Head, Part1 = Parts.FourPart, C0 = CFrame.new(0,0.15,12)}, Parts.FourPart)
}

So you’re creating Parts with the script that are Anchored, and when these Parts are welded with the last section of the script, you are creating the weld between the player’s Head and the 4 Parts and CFraming the C0 to move the Parts to (0,200,0), (0,100,0), (0,15,0), and (0,.15,12)?
If those Parts are Anchored of course it’s going to move the Head to whatever those locations are.

1 Like