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

Morph Gui working with Unions?

Asked by 9 years ago

I'm working on a game with some friends on Roblox and I'm using a 3D morph gui to select characters, and i'm wondering if there's a way to make the Unions appear, because when I select my characters, the union doesn't seem to show up, making the characters look rather glitchy.

Here's the script:

local Suit = game.Lighting:findFirstChild(script.Parent.Suit.Value) -- finds the suits local Me = script.Parent.Parent.Parent.Parent.Parent.Parent.Character -- finds you local Weapon = game.Lighting:findFirstChild(script.Parent.Weapon.Value) -- Give You A Weapon local Weapon1 = game.Lighting:findFirstChild(script.Parent.Weapon1.Value) -- Give You A Weapon local Weapon2 = game.Lighting:findFirstChild(script.Parent.Weapon2.Value) -- Give You A Weapon

function Click(mouse) print 'Click!' -- This function gives you the suit if Me:findFirstChild("Humanoid") ~= nil and Me:findFirstChild("Arm1") == nil then local g = Suit.Arm1:clone() g.Parent = Me 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 = Me["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
        h[i].Anchored = false
        h[i].CanCollide = false
    end

end

if Me:findFirstChild("Humanoid") ~= nil and Me:findFirstChild("Arm2") == nil then
    local g = Suit.Arm2:clone()
    g.Parent = Me
    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 = Me["Right 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
        h[i].Anchored = false
        h[i].CanCollide = false
    end

end

if Me:findFirstChild("Humanoid") ~= nil and Me:findFirstChild("Leg1") == nil then
    local g = Suit.Leg1:clone()
    g.Parent = Me
    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 = Me["Left Leg"]
            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

if Me:findFirstChild("Humanoid") ~= nil and Me:findFirstChild("Leg2") == nil then
    local g = Suit.Leg2:clone()
    g.Parent = Me
    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 = Me["Right Leg"]
            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
if Me:findFirstChild("Humanoid") ~= nil and Me:findFirstChild("Chest") == nil then
    local g = Suit.Chest:clone()
    g.Parent = Me
    local C = g:GetChildren()
            local R = Me:GetChildren()
    --for i=1, #R do
        --if R[i].className == "Hat" then
        --  R[i]:remove()
        --end
    --end
    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 = Me.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

--script.Parent.Parent.Visible = false

end

end

end

script.Parent.MouseButton1Down:connect(Click)

local debounce = false local Me2 = script.Parent.Parent.Parent.Parent.Parent.Parent.Backpack -- this puts the weapon into backpack

function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid then return players[i] end end return nil end

function Click2(mouse) print 'Click2!' -- Speed, Weapons, and Health Give in this Function local human = Me:findFirstChild("Humanoid") if (human ~= nil) and debounce == false then

debounce = true

local player = getPlayer(human)

if (player == nil) then return end

Weapon:clone().Parent = Me2 -- this makes when you click this GUI it weilds on you Weapon1:clone().Parent = Me2 -- these weapons go into your backpack (not auto weld like above) Weapon2:clone().Parent = Me2 wait(1) debounce = false --script.Parent.Parent.Visible = false --human.WalkSpeed = script.Parent.Speed.Value -- changes your WalkSpeed to the "Speed" Value --human.MaxHealth = script.Parent.Health.Value -- changes your MaxHealth to the "Health" Value --human.Health = script.Parent.Health.Value -- changes your MaxHealth to the "Health" Value end

end

script.Parent.MouseButton1Down:connect(Click2)

0
Format the entire code in a code block please. Tkdriverx 514 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

unions still aren't fully supported yet I think... check to make sure all those methods work with unions

Ad
Log in to vote
0
Answered by 6 years ago

just use C[i].className == "Part" or C[i].className == "UnionOperation"

Answer this question