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

How can I make different teams spawn with a custom character?

So my buddy told me that this would be hard so I went to this site again. Let's say I have 2 models that is R6, one model for each team. How can I make players spawn with those models though? Any help would be appreciated

5 comments

0

Your buddy isn't right.

0

Uhhh thanks for the link but I already made a custom character for each team, What I mean is how I can assign custom characters for different teams

0

Well, the guy isn't supposed to be entirely right.

0

ok

1 answer

This code does not entirely work, but this is pretty much the basis of what you're asking for. You could change it and make it work. You'll need a localscript to make the camera look at the custom character humanoidrootpart and blah blah blah. I only posted this as an answer because this can't fit in the comments. I could fix it myself, but it would take 2-3 hours. Good scripts take time.

function teamFromColor(color) 
for _,t in pairs(game:GetService("Teams"):GetChildren()) do 
if t.TeamColor==color then return t end 
end 
return nil 
end 

function onSpawned(plr) 
local characters = teamFromColor(plr.TeamColor):GetChildren() 
for _,c in pairs(characters) do 
if c:IsA("Model") and c:FindFirstChild("HumanoidRootPart") then
c.Archivable = true
local x = c:Clone()
x.Parent = workspace
x.HumanoidRootPart.CFrame = plr.Character.HumanoidRootPart.CFrame
plr.Character = x
end
end 
end 

function onChanged(prop,plr) 
if prop=="Character" then 
onSpawned(plr) 
end 
end 

function onAdded(plr) 
plr.Changed:connect(function(prop) 
onChanged(prop,plr) 
end) 
end 

game.Players.PlayerAdded:connect(onAdded)

1 comment

0

can you fix it plox

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