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

How do I make a holdable block?

Asked by 7 years ago

Basically, I made this key that has unions and parts in it and I don't know how to make it so a robloxian can pick it up and hold it in their hand. I tried different ways and the biggest problem I have is the key keeps falling apart into pieces and I tried weld scripts which didnt work out. I don't know what to do. ;o;

2 answers

Log in to vote
2
Answered by 7 years ago

Place the item into a tool. It just has to be named "Handle" then the player can hold it. That's the only way I can think of off the top of my head at the moment.

0
Also, one weld script you can use is qPerfectionWeld by Qwerty. Just make sure that the script is in the tool and there are no models inside of the tool. SchonATL 15 — 7y
Ad
Log in to vote
1
Answered by 7 years ago

Nevermind, I figured it out after I posted that question but here is the weld script I used which kept the tool and the actual key together.

function weld()
    local parts,last = {}
    local function scan(parent)
        for _,v in pairs(parent:GetChildren()) do
            if (v:IsA("BasePart")) then
                if (last) then
                    local w = Instance.new("Weld")
                    w.Name = ("%s_Weld"):format(v.Name)
                    w.Part0,w.Part1 = last,v
                    w.C0 = last.CFrame:inverse()
                    w.C1 = v.CFrame:inverse()
                    w.Parent = last
                end
                last = v
                table.insert(parts,v)
            end
            scan(v)
        end
    end
    scan(script.Parent)
    for _,v in pairs(parts) do
        v.Anchored = false
    end
end

weld()
script:Remove()

Answer this question