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

GroupChatGui2 - if plr.Team == "Raiders" or plr.TeamColor == "Bright red" then, not works.. Why?

When i switch to raider team and i chatted my rank appears.. Why is it not "RAIDER"?..

--> Line 15

local plr = game.Players.LocalPlayer
local chat = game.ReplicatedStorage.ChatHandler.ChatHistory
local last
local GroupId = 2642682

function newChat(msg,plr)
	if #msg > 0 then
		for i, c in pairs(chat:GetChildren()) do
			c.Position = c.Position - UDim2.new(0, 0, 0.1, 0)
		end
		local newMessage = script.Msg:clone()
		if #chat:GetChildren() == 6 then
			chat:GetChildren()[1]:Destroy()
		end
		if plr.Team == "Raiders" or plr.TeamColor == "Bright red" then
			newMessage.Text = "[RAIDER] "..plr.Name..": "..msg
			newMessage.Raider.Visible = true
		else
			newMessage.Rank.Text = "["..plr:GetRoleInGroup(GroupId).."] "
			newMessage.Text = "["..plr:GetRoleInGroup(GroupId).."] "..plr.Name..": "..msg
			newMessage.Rank.Visible = true
		end
		newMessage.Visible = true
		newMessage.Position = UDim2.new(0, 0, 0.6, 0)
		newMessage.Parent = game.ReplicatedStorage.ChatHandler.ChatHistory
		last = newMessage
	end
end

game.Players.LocalPlayer.Chatted:connect(function(msg)
	newChat(msg, plr) print("newChat")
	game.ReplicatedStorage.ChatHandler.NewMsg:FireServer(plr, msg) print("FireServer")
end)

1 answer

✓ Accepted answer
    if plr.Team == "Raiders" or plr.TeamColor == BrickColor.new("Bright red") then

You forgot BrickColor.new()

1 comment

0

You can also use plr.TeamColor.Name == 'Bright red'

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