So i was editing this custom chat, and i tried to make it so MY name would say [Assassin] But idk if i messed up please help
ChatColors = {"Deep blue","Bright red","Lime green","Bright yellow","Bright orange","Bright violet","White","Black","Pink","Brown"}
BannedWords = {"RUDEWORD","RUDEWORD","RUDEWORD","RUDEWORD","RUDEWORD"} -- Words players cannot use in the chat.
CustomColor = 159775970 -- The ID of the item needed to change their own custom chat color.
OPrefix = "[Noob]" -- Prefix used before an owner's name then message.
Owners = {"Mahem","zatch11"} -- Players who have the owner prefix.
APrefix = "[Admin]" -- Prefix used before an admin's name then message.
Admins = {"Wanwod","MekaX",""} -- Players who have the admin prefix.
WPrefix = "[yaya]"
Wanwod = {"Wanwod"}
game.Players.PlayerAdded:connect(function(player)
local SV = Instance.new("StringValue")
SV.Name = "SetColor"
SV.Value = ChatColors[math.random(1,#ChatColors)]
player.Chatted:connect(function(message)
if string.sub(message:lower(),1,3) == "/c " then
if game:GetService("MarketplaceService"):PlayerOwnsAsset(player,CustomColor) then
SV.Value = string.sub(message,4)
end
end
for i,a in pairs(game.Players:GetChildren()) do
b = a:FindFirstChild("PlayerGui"):FindFirstChild("CustomChat")
for i,c in pairs(b.ChatBox:GetChildren()) do
if c:IsA("TextLabel") then
c.Position = c.Position - UDim2.new(0,0,0.2,0)
if c.AbsolutePosition.Y <= 0 then
c:Destroy()
end
end
end
local d = game.ReplicatedStorage.Chat:Clone()
d.Parent = b.ChatBox
for i,v in pairs(BannedWords) do
if message:lower():find(v) then
d.Text = ""..player.Name.." tried to say a banned word!" break
end
end
if d.Text ~= ""..player.Name.." tried to say a banned word!" then
for i,x in pairs(Owners) do
if player.Name:lower():find(x:lower()) then
d.Text = ""..OPrefix.." "..player.Name..": "..message
else
for i,y in pairs(Admins) do
if player.Name:lower():find(y:lower()) then
d.Text = ""..APrefix.." "..player.Name..": "..message
for i,y in pairs(Wanwod) do
if player.Name:lower():find(y:lower()) then
d.Text = ""..WPrefix.." "..player.Name..": "..message
end
end
end
end
if d.Text ~= ""..OPrefix.." "..player.Name..": "..message and d.Text ~= ""..APrefix.." "..player.Name..": "..message and d.Text ~= ""..WPrefix.." "..player.Name..": "..message then
d.Text = ""..player.Name..": "..message
end
end
d.TextColor3 = BrickColor.new(SV.Value).Color
game.Debris:AddItem(d,30)
end
end)
end) |