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

How do I make my arm morph touch function work on a gui with a click function?

Asked by 6 years ago
Edited 6 years ago

first thing here is a picture of the explorer (do not pay attention at the script in head called script the important one wich contain my script is the one called Arm1)

(http://i.gyazo.com/7c7274ac2785ca90480d7f3466c9d62e.png)

basicly want I want to do is be able toput the script called Arm1 in the button gui called Button1 and I will need to know where I have to place the arm model to do this and that after that this works I could like delete the part called head because the button gui would do the job of the head model

heres the script inside of the Arm1 script

function onTouched(hit)
    if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("Arm1") == nil then
        local g = script.Parent.Parent.Arm1:clone()
        g.Parent = hit.Parent
        local C = g:GetChildren()
        for i=1, #C do
            if C[i].className == "Part" then
                local W = Instance.new("Weld")
                W.Part0 = g.Middle
                W.Part1 = C[i]
                local CJ = CFrame.new(g.Middle.Position)
                local C0 = g.Middle.CFrame:inverse()*CJ
                local C1 = C[i].CFrame:inverse()*CJ
                W.C0 = C0
                W.C1 = C1
                W.Parent = g.Middle
            end
                local Y = Instance.new("Weld")
                Y.Part0 = hit.Parent["Left Arm"]
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0
        end

        local h = g:GetChildren()
        for i = 1, # h do
            if h[i].className == "Part" then
                h[i].Anchored = false
                h[i].CanCollide = false
            end
        end

    end

end

script.Parent.Touched:connect(onTouched)

if you need more information message me here: https://www.roblox.com/messages/compose?recipientId=73528128

Answer this question