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

[Hat Positions] Module Script?

Asked by 9 years ago

Setting Hats Position Via Script Here is what this script does. You input a CharacterModel, and it returns it as a script, All I need is it to return the Hat's Positions. :D Starts on line 28

local module = {}
hatNum = 0
shirtNum = 0
pantNum = 0
module.Character = function(character)
    print("-- Loading Character: " .. character.Name)
    wait(3)
    print("-------------------------------------")
    print("change." .. character.Name .. "= function(player)")
    print(" char = player.Character")
    print("char.Archivable = true")
    print("-- Clothes Removal")
    print("wait(.1)")
    print("for _,i in ipairs(char:GetChildren()) do")
    print("if i.ClassName == 'ShirtGraphic' or i.ClassName == 'Shirt' or i.ClassName == 'Hat' or i.ClassName == 'Pants' then")
    print("     i:remove()")
    print(" end")
    print("end")
    print("wait(1)")
    for i,v in pairs(character:GetChildren()) do
        if v:IsA("Hat") then
             hatNum = hatNum +1
            print("hat" .. hatNum .. " = Instance.new('Hat', player.Character)")
            print("handle = Instance.new('Part')")
            print("handle.Name = 'Handle'")
            print("mesh = Instance.new('SpecialMesh')")
            print("mesh.TextureId = " .. "'" .. v.Handle.Mesh.TextureId .. "'")
            print("hat" .. hatNum .. ".AttachmentForward = Vector3.new(" .. v.Hat.AttachmentForward .. ")") -- THESE LINES NEED FIXING
            print("hat" .. hatNum .. ".AttachmentPos = Vector3.new(" .. v.Hat.AttachmentPos .. ")") -- THESE LINES NEED FIXING
            print("hat" .. hatNum .. ".AttachmentRight = Vector3.new(" .. v.Hat.AttachmentRight .. ")")-- THESE LINES NEED FIXING
            print("hat" .. hatNum .. ".AttachmentUp = Vector3.new(" .. v.Hat.AttachmentUp .. ")")-- THESE LINES NEED FIXING
            print("hat" .. hatNum .. ".Archivable = true")      
            print("mesh.MeshId = " .. "'" .. "'" .. v.Handle.Mesh.MeshId .. "'" )
            print("mesh.Parent = handle")
            print("handle.Parent = hat" .. hatNum)
        elseif v:IsA("Shirt") then
            shirtNum = shirtNum +1
            print("shirt" .. shirtNum .. "= Instance.new('Shirt', player.Character)")
            print("shirt" .. shirtNum .. ".ShirtTemplate = " .. "'" .. v.ShirtTemplate .. "'")
        elseif v:IsA("Pants") then
            pantNum = pantNum +1
            print("pants" .. pantNum .. "= Instance.new('Pants', player.Character)")
            print("pants" .. pantNum .. ".PantsTemplate = '" .. v.PantsTemplate .. "'")
        end
    end
    if character.Head:FindFirstChild("face") then
    print("character.Head.face.Texture = '" .. character.Head.face.Texture .. "'")
    elseif character.Head:FindFirstChild("Decal") then
        print("character.Head.face.Texture = '" .. character.Head.Decal.Texture .. "'")
    elseif character.Head:FindFirstChild("Face") then
        print("character.Head.face.Texture = '" .. character.Head.Face.Texture .. "'")
    end
    print("end")
end
return module


Answer this question