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

How can i print out messages (with a script) to chat with a prefix?

Asked by
JanT2 0
3 years ago

I'm trying to create something like a "Emergency Call Service" and i want to display the Emergency to chat (like "[SYSTEM]: XY sent an emergency call for EMS"). I already have all setup, but i want a prefix at the beginning (like this: "(red)[SYSTEM]:(red) (white)XY...".

That's my current code.

local button = script.Parent
local player = game.Players.LocalPlayer
local etype = script.Parent.Parent.Dropdown.TextButton

button.MouseButton1Click:Connect(function()
    if etype.Text == "EMS" then
        print("EType found and sent!")

        game.StarterGui:SetCore("ChatMakeSystemMessage", {

            Text = "[SYSTEM]: "..player.Name.." sent an emergency call for EMS!", Color = Color3.new(1, 0, 0.0156863)

        })

    else
        print("EType not found")            
    end
end)        

--[[ Ignore
button.MouseButton1Click:Connect(function()
    if etype.Text == "Police" then
        print("EType found and sent!")

        game.StarterGui:SetCore("ChatMakeSystemMessage", {

            Text = ""

        })

    else
        print("EType not found")            
    end
end)        
--]]

Answer this question