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

What errors have i made in this script for turning a character into a morph?

Asked by 6 years ago

This is a 3d morph with multiple parts, Steven2 is the chest and Steven2mid is the middle. I tried to make this script from an ontouch to a onclick but it does not work, what errors have i made?

function onClick() if hit.Parent:findFirstChild("Humanoid") ~= nil and Players.LocalPlayer.Character.hit.Parent:findFirstChild("Steven2") == nil then local g = script.Parent.Parent.Steven2:clone() g.Parent = game.Players.LocalPlayer.Character.hit.Parent local C = g:GetChildren() for i=1, #C do if C[i].className == "Part" or "Union" then local W = Instance.new("Weld") W.Part0 = g.Steven2mid W.Part1 = C[i] local CJ = CFrame.new(g.Steven2mid.Position) local C0 = g.Steven2mid.CFrame:inverse()CJ local C1 = C[i].CFrame:inverse()CJ W.C0 = C0 W.C1 = C1 W.Parent = g.Steven2mid end local Y = Instance.new("Weld") Y.Part0 = game.Players.LocalPlayer.Character.hit.Parent.Torso Y.Part1 = g.Steven2mid 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" or "Union" then
            h[i].Anchored = false
            h[i].CanCollide = false
        end
    end

end

end

script.Parent.MouseButton1Click:connect(onClick)

Answer this question