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

Help with adding Tag to ChatGui? [closed]

Asked by 9 years ago

This is what i have so far but i need help making a [Owner],[Admin] and [Vip] to this script trying to make it look like this example

EXAMPLE [OWNER] Markel1234567: Blalala, EXAMPLE [ADMIN] RandomPlayer: Blalalala And for the vip i trying to make it when you buy gamepass then you will have , [VIP] RandomPlayer: Blalalalala

local storage=game:GetService("ServerStorage")
local sharedstorage=game:GetService("ReplicatedStorage")
local chatevent=sharedstorage:WaitForChild("ChatEvent")

local systemfontcolor=Color3.new(.83,.83,.83)

function sendchat(chattype,name,chat,namecolor,textcolor)
    if chattype=="system" or chattype=="outmatch" then
        for _,plr in pairs(game.Players:GetPlayers()) do
            if true then    --some kind of exclusive chat
                chatevent:FireClient(plr,name,chat,namecolor,textcolor)
            end
        end
    elseif chattype=="inmatch" then
        chatevent:FireAllClients(name,chat,namecolor,textcolor)
    else
        chatevent:FireAllClients(name,chat,namecolor,textcolor)
    end
end

function newplayer(plr)
    print("Player added yes",plr)
    sendchat("system",nil,""..plr.Name.."  joined",systemfontcolor,systemfontcolor)
    local lastchattime=tick()
    local lastmsg=""
    plr.Chatted:connect(function(msg)
        local currenttime=tick()
        if plr and msg and msg~="" and string.sub(msg,1,2)~="/w" and string.sub(msg,1,2)~="/e" and(msg~=lastmsg or (currenttime-lastchattime)>3) and (currenttime-lastchattime)>.5 then
            lastchattime=currenttime
            local lastmsg=msg
            if hascharactertag and hascharactertag.Value and plr.Character then
                sendchat("outmatch",plr.Name.." :",msg)
            else
                sendchat("inmatch",plr.Character.Name.." :",msg,Color3.new(255, 255, 255))
            end
        end
    end)
end

game.Players.PlayerAdded:connect(newplayer)
for _,plr in pairs(game.Players:GetPlayers()) do
    newplayer(plr)
end

game.Players.PlayerRemoving:connect(function(plr)
    if plr then
        sendchat("system",nil,""..plr.Name.."  left",systemfontcolor,systemfontcolor)
    end
end)

Closed as Not Constructive by evaera

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?