Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How i can convert from Morph Button to Morph Gui Button?

I tried convert it by using almost this same script what have my giver script but it didn't work. There is script:

player = script.Parent.Parent.Parent.Parent.Parent
model = game.ReplicatedStorage.BB:findFirstChild("Chest")

function onButtonClicked(click)
		local g = model:clone()
		g.Parent = click.Parent
		local C = g:GetChildren()
		for i=1, #C do
			if C[i]:IsA("BasePart") 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 = click.Parent.Torso
				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
			h[i].Anchored = false
			h[i].CanCollide = false
		end
	end


script.Parent.MouseButton1Click:connect(onButtonClicked)

In BB is a group with name Chest and inside it is a part's what i want weld to Torso. If someone know how fix that can you tell me how? ;/ I was working at it by some day's but i'm failing all time.

1 answer

✓ Accepted answer

Here's the solution this this problem

player = script.Parent.Parent.Parent.Parent.Parent
model = game.ReplicatedStorage.BB:findFirstChild("Chest")
character = player.Character
function onButtonClicked()
        local g = model:clone()
        g.Parent = character
        local C = g:GetChildren()
        for i=1, #C do
            if C[i]:IsA("BasePart") 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 = character.Torso
                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
            h[i].Anchored = false
            h[i].CanCollide = false
        end
    end


script.Parent.MouseButton1Click:connect(onButtonClicked)

This discussion is preserved as it was. New answers, comments, and votes are closed.