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
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.
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)
workspace.CurrentCamera.CameraType = Enum.CameraType.Follow workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.HumanoidRootPart
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
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.