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

How the heck do you make team only avatars?

I'm making this Vietnam War based game and I'm trying to get team only avatars. I made 2 models 1 for VC, 1 for USMC, but I made them as StarterCharacters. Help me with this please :(

This is the code I tried using, as its free modeled I don't understand it.

local TeamAppearances = {USAF = "3859337296",
					 VietCong = "3859340251"}

-- for character appearance-changing, this part never changes and always comes first, right before the UserID that you want to dress like
local TeamBaseURL = "http://www.roblox.com/Asset/CharacterFetch.ashx?userId="

-- since this script is in StarterPack, it'll get put into Player.Backpack, so script.Parent.Parent is the player
local Player = script.Parent.Parent

-- loop through all the teams and find the one with the same color as our player
for _, team in pairs(game.Teams:GetTeams()) do
	if (Player.TeamColor.Name == team.TeamColor.Name) then
		-- now find the team appearance in our table, if it exists
		local teamAppearance = TeamAppearances[team.Name]
		if teamAppearance then
			-- we've got the appearance; now dress the player!
			Player.CharacterAppearance = TeamBaseURL .. teamAppearance
		end
	end
end

5 comments

1

you cant tell us that u just took a script from the toolbox and want us to fix it for u because u dont understand it

0

im asking whats wrong with it

0

well im not going to help until u try make ur own team script

0

Do you have any error codes? If not use print() to find out where the code stops at.

0

ContentProvider:Preload() failed for rbxassetid://1099104545

2 answers


[EDIT] - Changing Player's Character to another Character Model

Found a way how to do it with a model instead of a player's user ID. Basically, change the player's Character property to a model that you cloned from the server storage and clone in a few scripts to make the character work.

Normal Script:

character1 = game.ServerStorage.Character1
animationScript = game.ServerStorage.Animate
cameraUpdateScript = game.ServerStorage.UpdateCamera

function changeCharacterModel(player)
	local cameraScriptClone = cameraUpdateScript:Clone()
	local clone = character1:Clone()
	local animationScriptClone = animationScript:Clone()
	clone.Parent = game.Workspace
	player.Character = clone
	animationScriptClone.Parent = clone
	cameraScriptClone.Parent = player.PlayerGui
	
	--need to reconnect died function every time we make a new character so we're calling this again
	clone.Humanoid.Died:Connect(function()
		changeCharacterModel(player)
	end)
end

game.Players.PlayerAdded:Connect(function(player)
	game.Workspace:WaitForChild(player.Name) -- wait for the character to spawn into the workspace
	changeCharacterModel(player)
	
	--change characters model when they die
	player.Character.Humanoid.Died:Connect(function()
		changeCharacterModel(player)
	end)
end)

UpdateCamera script: (this is a local script)

workspace.CurrentCamera.CameraType = Enum.CameraType.Follow
workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.HumanoidRootPart	
OLD ANSWER:



What the script is doing is changing a characters appearance based off another character's appearance. The ids in TeamAppearances are user IDs but it seems like either the users who have those IDs are banned or they don't exist.

If you want to use that script, find a user you like the look of and paste in their userID

For example, my user is https://www.roblox.com/users/20111088/profile and my userId is 20111088

4 comments

0

lucyy, im trying to get character models instead of players and i couldnt find any team-only avatar scripts.

0

Yeah, that's doable. I'll edit my post in a few minutes to show you how to do it.

0

Take a look at my post

0

did this work? please mark it as accepted if it works.

Dude, it’s simple: DONT USE FREE MODELS / SCRIPTS. You usually don’t understand them, and sometimes they contain bad things. Look it up on YouTube, but nobody here is going to fix a problem with a free script that you don’t understand.

1 comment

0

If your are not posting an explanation, DO NOT POST A ANSWER!.

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