Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How the heck do you make team only avatars?

Asked by 5 years ago

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

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 Gameplayer365247v2 1055 — 5y
0
im asking whats wrong with it daffynimm123 4 — 5y
0
well im not going to help until u try make ur own team script Gameplayer365247v2 1055 — 5y
0
Do you have any error codes? If not use print() to find out where the code stops at. pwx 1581 — 5y
0
ContentProvider:Preload() failed for rbxassetid://1099104545 daffynimm123 4 — 5y

2 answers

Log in to vote
1
Answered by
royaltoe 5144 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

[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

0
lucyy, im trying to get character models instead of players and i couldnt find any team-only avatar scripts. daffynimm123 4 — 5y
0
Yeah, that's doable. I'll edit my post in a few minutes to show you how to do it. royaltoe 5144 — 5y
0
Take a look at my post royaltoe 5144 — 5y
0
did this work? please mark it as accepted if it works. royaltoe 5144 — 5y
Ad
Log in to vote
-1
Answered by 5 years ago

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.

0
If your are not posting an explanation, DO NOT POST A ANSWER!. BashGuy10 384 — 5y

Answer this question