Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I need help with a Team Auto Clother!?!

So I need help with a Team Auto Clother. I don't even know were to start. I am really new to scripting too.

6 comments

0

just how new are you?

0

Um I started around 2 weeks ago

0

Glad you're interested in scripting! I hope all goes well. This video should give you a head start. It shows you how to make what you're asking for. https://www.youtube.com/watch?v=m3pG3tjQLog

0

It unfortunately doesn't explain the code. If you are confused about the code or if there's anything you want to do differently, hit me up on discord and I can help explain it to you. Lucy #4854

0

oK tHANK YOU

0

caps

1 answer

✓ Accepted answer

If anyone else is viewing this thread, OP followed this tutorial to figure out how to change teams / shirts of the teams by using this tutorial

Instead of changing the player's clothes every time the player reset, BMA wanted the player's clothes to change whenever the player clicked a button.

We had to use remote events to change the player's team after they clicked a button.

We created a remote event called ChangeTeam which was fired whenever the player clicked the button to change their team.

The code for this was inside a localscript inside the button that the player was supposed to click:

changeTeam = game.ReplicatedStorage.ChangeTeam 

script.Parent.MouseButton1Click:Connect(function()
	changeTeam:FireServer("Team2") --tell the server that we want to change the player's team to team2 by firing a remote event with the name of the team we want to change the player's team to
end)

Once we fired the remote event, we changed the team on the server:

--changes the players team
changeTeam = game.ReplicatedStorage.ChangeTeam 

changeTeam.OnServerEvent:Connect(function(player, teamToChangeTo)
	player.Team = game.Teams[teamToChangeTo]
end)

we also had a function on the server to change the players clothes whenever their team changed:

game.Players.PlayerAdded:Connect(function(player)
	--this function changes the player's clothes when their team changes
	player:GetPropertyChangedSignal("Team"):Connect(function()
		local character = player.Character
		if(player.Team == game.Teams["Team1"] then
character:WaitForChild("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=(ID HERE)"
character:WaitForChild("Pants").PantsTemplate = "http://www.roblox.com/asset/?id=(ID HERE)"
		end
	end)

	--this function makes sure the player's clothes changes whenever they resets / joins the game
	player.CharacterAdded:Connect(function(character)
				local character = player.Character
		if(player.Team == game.Teams["Team1"] then
			character:WaitForChild("Shirt").ShirtTemplate = "rbxassetid://(your asset id here)"
			character:WaitForChild("Shirt").PantsTemplate= "rbxassetid://(your asset id here)"
		end
	end)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.