Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesn't my weld script position the hat correctly?

Asked by 8 years ago

My weld script is supposed to weld the gasmask to the player positioning it over the player. It's supposed to be just like a hat. Instead it decides that it's okay to position itself behind/in front of my player when I need it to be in the exact location of the players head position. What is going on, and how can I fix this?

local hat= script.GasMask local weld

01function weld(h,c)
02    local hat2= h:clone()
03    hat2.Parent= c
04    local head = c:FindFirstChild("Head")
05    if head ~= nil then
06    local p
07    for _,v in pairs(hat2:GetChildren()) do
08        if v:IsA("Part") or v:IsA("UnionOperation") or v:IsA("MeshPart") then
09            local weld= Instance.new("Weld")
10            weld.Parent= head
11            local core= v.Parent:FindFirstChild("Core")
12            if core ~= nil then
13                weld.Part0 = head
14                weld.Part1 = v
15                local lol = CFrame.new(head.Position.X,head.Position.Y,head.Position.Z)
View all 48 lines...

Answer this question