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

How to make a script that will make a player wear a uniform?

Asked by 8 years ago
Edited 8 years ago

I need a script that will actually make a player wear a uniform depending on his rank in a specific group, and wear an helmet depending the group. I actually have, in the serverStorage, a folder "Uniform" and inside it theres the folder 'clothes' that actually contain all the clothes of the different legion/rank inside this legion (As 104thHrPants / 104thHrShirt / 104thPants / 104thShirt) and a folder "Helmet" (104thHrHelmet / 104thHelmet) <-- each of them have their specific clothe ID. Hr Rank start at '100'

RegShirt = game.ServerStorage.Uniform.Clothes.RegShirt
game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        if plr:GetRankInGroup(2772068) > 100 then
            player.ClearCharacterAppearance()

            player.LoadCharacterAppearance(RegShirt) 
        end
    end)
end)

In a past request someone has gave me this script, but it doesnt make the player wear the shirt/pants over and doesnt make the player wear the Helmet (The helmet is not in the catalog)

0
What value does the word Item hold in LoadCharacterAppearance? yougottols1 420 — 8y
0
Well, I should have put "RegShirt = game.ServerStorage.Uniform.Clothes.RegShirt" and the item would be replaced by; RegShirt MatthewMinghetti 10 — 8y

2 answers

Log in to vote
1
Answered by
itsJooJoo 195
8 years ago
Edited 8 years ago

This is one, rather than wasting storage by putting shirts and pants there. For hats, I can't help you:

local shirtid = 0 --Add the ID of the shirt here
local pantsid = 00 --Add the ID of the pants here

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(chr)
        if plr:GetRankInGroup(2772068) > 100 then
            local shirt = chr:FindFirstChild("Shirt")
            if shirt then
                shirt.ShirtTemplate = "rbxassetid://" ..shirtid
            else
                local nshirt = Instance.new("Shirt", chr)
                nshirt.Name = "Shirt"
                nshirt.ShirtTemplate = "rbxassetid://" ..shirtid
            end
            local pants = chr:FindFirstChild("Pants")
            if pants then
                pants.PantsTemplate = "rbxassetid://" ..pantsid
            else
                local npants = Instance.new("Pants, chr")
                npants.Name = "Pants"
                npants.PantsTemplate = "rbxassetid://" ..pantsid
            end
            --If you want to remove T-Shirts, then leave this code. If not, then erase that
            local tee = chr:FindFirstChild("ShirtGraphic")
            if tee then
                tee:Destroy()
            end
        end
    end)
end)
0
Thanks but I got like over 20 pants/shirt, I think make that would take too long. (the Shirtid = 00) MatthewMinghetti 10 — 8y
Ad
Log in to vote
0
Answered by
Validark 1580 Snack Break Moderation Voter
8 years ago

Here is a revised answer. Adjust this to match your needs

-- @author itsJooJoo
-- @author Narrev

local ShirtId = 0
local PantsId = 0
local RemoveTShirts = true
local RemoveHats = true

local Hat = script:FindFirstChild("Hat") -- Put directory of hat here

game:GetService("Players").PlayerAdded:connect(function(Player)
    -- Run each a time a player joins
    Player.CharacterAdded:connect(function(Character)
        -- Run each time a player spawns
        if Player:GetRankInGroup(2772068) > 99 then
            local Shirt = Character:FindFirstChild("Shirt") or Instance.new("Shirt", Character)
            Shirt.Name = "Shirt"
            Shirt.ShirtTemplate = "rbxassetid://" ..ShirtId

            local Pants = Character:FindFirstChild("Pants") or Instance.new("Pants, Character")
            Pants.Name = "Pants"
            Pants.PantsTemplate = "rbxassetid://" ..PantsId

            if RemoveTShirts then
                local T_Shirt = Character:FindFirstChild("ShirtGraphic")
                if T_Shirt then
                    T_Shirt:Destroy()
                end
            end

            if RemoveHats then
                for _, Object in next, Character:GetChildren() do
                    if Object:IsA("Hat") then
                        Object:Destroy()
                    end
                end
            end

            if Hat then
                local Hat = Instance.new("Part")
                Hat.BottomSurface = "Smooth";
                Hat.TopSurface = "Smooth";
                Hat.Size = Hat.Size;
                Hat.Name = "Hat";

                local Mesh = Instance.new("SpecialMesh", Hat)
                Mesh.MeshType = "FileMesh";
                Mesh.MeshId = robloxAsset .. Hat.MeshId;
                Mesh.Scale = Hat.Scale;
                Mesh.TextureId = robloxAsset .. Hat.TextureId;

                local Weld = Instance.new("Weld", Hat)
                Weld.Name = "HatWeld";
                Weld.Parent = ;
                Weld.Part0 = Character.Head;
                Weld.Part1 = Hat;
                Weld.C0 = CFrame.new(0, .5, 0);
                C1 = Hat.AttachmentPoint or CFrame.new(0, 0.3, 0.05);

                Hat.Parent = Character
            end
        end
    end)
end)
0
Here again thanks but it would take too much "shirtID = 0" and "pantsId = 0". MatthewMinghetti 10 — 8y

Answer this question