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

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

Asked by 8 years ago
Edited 8 years ago

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

Log in to vote
0
Answered by 8 years ago
    if plr.Team == "Raiders" or plr.TeamColor == BrickColor.new("Bright red") then

You forgot BrickColor.new()

0
You can also use plr.TeamColor.Name == 'Bright red' User#5423 17 — 8y
Ad

Answer this question