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

What is the difference between BrickColor and userdata?

wait(6)

while true do
	p = game.Players:GetChildren()
	randplayer = p[math.random(#p)]
	randplayer.TeamColor = game.Teams:findFirstChild("Camo")
	randplayer.Character:BreakJoints() 
	m = Instance.new("Message")
	m.Parent = workspace
	m.Text = randplayer.Name.." is the zombie! "
	wait(3)
	m.Parent = nil
	wait(300)
	for i = 1,#p do
		if p[i].TeamColor == BrickColor.new("Camo") then
			p[i].TeamColor = BrickColor.new("White")
			end
		end
	m.Parent = workspace
	m.Text = "End of game"
	wait(4)
	m.Parent = nil
end

In the output window, it says : Workspace.Script:7: bad argument #3 to 'TeamColor' (BrickColor expected, got userdata)

1 answer

✓ Accepted answer
wait(6)
while true do
    p = game.Players:GetChildren()
    randplayer = p[math.random(#p)]
    randplayer.TeamColor = game.Teams:findFirstChild("Camo").TeamColor
    randplayer.Character:BreakJoints()
    m = Instance.new("Message")
    m.Parent = workspace
    m.Text = randplayer.Name.." is the zombie! "
    wait(3)
    m.Parent = nil
    wait(300)
    for i = 1,#p do
        if p[i].TeamColor == BrickColor.new("Camo") then
            p[i].TeamColor = BrickColor.new("White")
            end
        end
    m.Parent = workspace
    m.Text = "End of game"
    wait(4)
    m.Parent = nil
end

The problem was on line 6 you didn't define what color to change randplayer.TeamColor's teamcolor to.

1 comment

0

Thank you, sir. You helped me.

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