Auto Team Armour, need help please

Hello everyone, I’ve been trying for about a week now to make a Team Armor script where let’s say if you were on TeamA, you would get a helmet attached to your head on spawn and if you were on teamB, you would get a vest.

I’m trying to make a SCP game and need help with making a script like that, if anyone has any ideas on how to make one, let me know.
I’m really stuck…

2 Likes

Create your helmet and vest accessory, put them in the replicated storage.
Create your 2 team
Then put this script in the StarterCharacterScript

local Character = script.Parent
local Player = game.Players:FindFirstChild(Character.Name)

if not Character:FindFirstChild("Helmet")and Player.TeamColor == BrickColor.new("Bright blue")then
	local Clone = game.ReplicatedStorage.Helmet:Clone()
	Clone.Parent = Character
elseif not Character:FindFirstChild("Vest")and Player.TeamColor == BrickColor.new("Bright red")then
	local Clone = game.ReplicatedStorage.Vest:Clone()
	Clone.Parent = Character
end

Also there is another way to do it, is to put this script in the serverScriptService then it will add the accessory when player respawn

local Players = game:GetService("Players")

local function onCharacterAdded(Character)
	local Player = game.Players:FindFirstChild(Character.Name)
	if not Character:FindFirstChild("Helmet")and Player.TeamColor == BrickColor.new("Bright blue")then
		local Clone = game.ReplicatedStorage.Helmet:Clone()
		Clone.Parent = Character
	elseif not Character:FindFirstChild("Vest")and Player.TeamColor == BrickColor.new("Bright red")then
		local Clone = game.ReplicatedStorage.Vest:Clone()
		Clone.Parent = Character
	end
end

local function onPlayerAdded(player)
	player.CharacterAdded:Connect(onCharacterAdded)
end

Players.PlayerAdded:Connect(onPlayerAdded)
5 Likes

I’ll try it out right now, if this works i’ll be so happy :slight_smile:

3 Likes

Here is the roblox folder if you want to test it.
You only need to add your helmet / vest model and attachments in the accessory
Teams.rbxl (25,9 Ko)

1 Like

Thank you so much!! I appreciate it!

2 Likes

Anyway that I can actually attach the “Vest” to the upper torso or just the torso?
The helmet works but the torso is stuck to my head and rotated.

R6 and R15 character has the same attachments for accessory.

  1. Create a basic “Part”, Size 1,1,1, No anchored, No Can Collide, 1 Transparency.
  2. Rename it “Handle” and place it in the accessory.
  3. Create an “attachment” inside the “Handle” part, rename it “BodyFrontAttachment”.

So here when the accessory will be in a Character, the “Handle” part will be auto placed on the character torso

Now you can add your vest meshes / parts inside the “Handle” part, put them all no anchored and no can collide and correctly place them where is the Handle part in the workspace.

Weld all meshes / parts of your model to the “Handle” part by using this plugin: Weld - Roblox

To use the plugin, select the “Handle” part and all meshes / parts of your model and click the “Weld All” Button

1 Like

Thank you so much again, it worked

1 Like

Fixed it! Anyways, thank you so much for your help!
Without you, i don’t think i would be able to finish this game! :slight_smile:image

1 Like

Np for the help,
I’ve make a vest accessory for you with a free mesh if you want to check it (It is a bit to late xD)
Vest.rbxl (55,7 Ko)
Accessory are really easy and fast to make when you know how it work ^^

Also, one last thing.
Anyway to make it remove the players hats first?

To remove the wrong accessory if the player is in the other team

if not Character:FindFirstChild("Helmet")and Player.TeamColor == BrickColor.new("Bright blue")then
	local Clone = game.ReplicatedStorage.Helmet:Clone()
	Clone.Parent = Character
elseif not Character:FindFirstChild("Vest")and Player.TeamColor == BrickColor.new("Bright red")then
	local Clone = game.ReplicatedStorage.Vest:Clone()
	Clone.Parent = Character
end
if Character:FindFirstChild("Helmet")and not Player.TeamColor == BrickColor.new("Bright blue")then
	Character.Helmet:Destroy()
elseif Character:FindFirstChild("Vest")and not Player.TeamColor == BrickColor.new("Bright red")then
	Character.Vest:Destroy()
end

Thank you so much again lol, this will help me so much

I got confused again, so the script works perfectly fine just I would like it so when you spawn on a team for example, when you join TeamA, it will remove all your hats THEN put of the custom hats. Very confused on how to make this

Basically it would remove the dino suit and all that but keep the Vest and hat thing image

You can call RemoveAccessories prior to adding the vest and hat. This’ll remove all hats the player is wearing and then you can add your own hats to the character. Alternatively, use GetAccessories, go through the table it gives back and act based on the hat’s name.

I literally have no idea on how to do that lol, If you can could you send a script with the script above that Crygen made? Thanks :slight_smile:

Sorry but I don’t normally provide entire scripts because that’s not exactly the point of this category. It wouldn’t be helpful for the sake of learning and understanding what you’re doing which in turn can make future maintenance of your code more difficult.

That being said, in this case RemoveAccessories is just a simple call on the Humanoid. You simply need to have access to the Humanoid and then you can call RemoveAccessories on it. Do so before adding the hats. If you have access to the character, you can also get a reference to the character.

There is a code sample on the page you can reference.

Alright, thank you very much! much appreciated