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

How do i make a player morph when he clicks a Gui ?

Asked by 10 years ago
local archer = Instance.new("ImageButton",fr)
    archer.Position = UDim2.new(0.1,0,0.4,0)
    archer.Size = UDim2.new(0.25,0,0.5,0)
    archer.Image = "http://www.roblox.com/asset/?id=147172117" 
    archer.BackgroundColor3 = Color3.new(255,85,0)
    archer.BorderColor3 = Color3.new(255,0,0)
    archer.MouseButton1Click:connect(function(Player)
        archerchar = player.Character
        local d = player.Parent:GetChildren()
        if archerchar.Parent:findFirstChild("Humanoid") ~= nil and archerchar.Parent:findFirstChild("Arm1") == nil then
        local g = game:GetService("Lighting").Arm1:clone()
        g.Parent = archerchar
        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 = archerchar.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

        sg:Destroy()
    end)

dont worry about that imagebuttons not on frame or screenGui this is only a part of my script . this is my try and it seems not to be working . the arm1 is in lighting .

Answer this question