Help with auto uniforms

Sometimes :PlayerAdded() doesnt fire in studio, publish the game and play it

This happened when I was in Studio now.

Image:

You need to move the attachment in Handle

It is currently in handle. It may be that the handle was an actual part of the vest. Would that be a problem?

This is where I changed the name to handle.

Image:

I figured it out, the only problem is is that it is attached to the head for some reason.

Image:

The attachment seems to be in the right place but it is attaching to the head for some reason.

Image:

Rename it to RootAttachment to make it work

Got it! Now if I was to add the other parts of the armor, would I just copy and paste chunks of the script?

You can do this:

local Players = game:GetService("Players")
local GroupId = 10001027

Players.PlayerAdded:Connect(function(Player)
	if Player:IsInGroup(GroupId) then
		if Player:GetRankInGroup(GroupId) == 100 then
			local Character = Player.Character or Player.CharacterAdded:Wait()
			local Vest = game.ServerStorage.Vests["Vest-100"]:Clone()
			local Helmet = game.ServerStorage.Helmets["Helmet-100"]:Clone()

			Vest.Parent = Character
			Helmet.Parent = Character
		elseif Player:GetRankInGroup(GroupId) == 255 then
			local Character = Player.Character or Player.CharacterAdded:Wait()
			local Vest = game.ServerStorage.Vests["Vest-255"]:Clone()
			local Helmet = game.ServerStorage.Helmets["Helmet-255"]:Clone()

			Vest.Parent = Character
			Helmet.Parent = Character
		end
	end
end)

I did this and the script does work, but now the helmet parents to the players chest, not the head.

Image:

U need to change attachment’s name. Attachments you can find in any character model

1 Like

How do you load in this character model?

Moon Animator has a thing called Character Inserter

Found it, thank you! I gave you a solution.

1 Like

@Ti4rin, there is one more thing I would like to ask you regarding the auto uniforms. How would I remove default accessories such as hats and hairs? I do not want to remove the accessories that I have already added. Also, how would I make auto clothing applied as well to the script?

Another thing that isn’t working is when you reset, the uniforms do not restore to your character. How would I fix this as well?

For that use Humanoid:RemoveAccessories() and Humanoid.Died:Connect()

Where would I put these in the script?

This is what is happening when you reset. I will include a recording below.

Recording:

local Players = game:GetService("Players")
local GroupId = 10001027

Players.PlayerAdded:Connect(function(Player)
	if Player:IsInGroup(GroupId) then
		if Player:GetRankInGroup(GroupId) == 100 then
			local Character = Player.Character or Player.CharacterAdded:Wait()
			local Humanoid = Character:WaitForChild("Humanoid")
			
			Humanoid:RemoveAccessories()

			local Vest = game.ServerStorage.Vests["Vest-100"]:Clone()
			local Helmet = game.ServerStorage.Helmets["Helmet-100"]:Clone()

			Vest.Parent = Character
			Helmet.Parent = Character
			
			Humanoid.Died:Connect(function()
				-- Equip it again
			end)
		elseif Player:GetRankInGroup(GroupId) == 255 then
			local Character = Player.Character or Player.CharacterAdded:Wait()
			local Humanoid = Character:WaitForChild("Humanoid")

			Humanoid:RemoveAccessories()

			local Vest = game.ServerStorage.Vests["Vest-255"]:Clone()
			local Helmet = game.ServerStorage.Helmets["Helmet-255"]:Clone()

			Vest.Parent = Character
			Helmet.Parent = Character

			Humanoid.Died:Connect(function()
				-- Equip it again
			end)
		end
	end
end)

Other stuff do by yourself