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

how can i send a system message back like "not found" on the chat when i enter a command?

Asked by 5 years ago
Edited 5 years ago

i tryed this but get back the channel is nil and the warn is only for server message for output

01local AdminCommands = require(1163352238)
02local Utilities = AdminCommands.Utilities
03 
04local ZombyGame = "/zombie "
05 
06local function onOwnerChatted(player, message, channel)
07 
08    if message:sub(1, ZombyGame:len()):lower() == ZombyGame:lower() then
09 
10        local aMessage = message:sub(ZombyGame:len() + 1)
11 
12        if aMessage == "on" then
13 
14            local zombiegame = game.ReplicatedStorage.MiniGames:FindFirstChild("ZombieGame")
15 
View all 66 lines...

i did have made my own channel and this script is a normale script in ServerScriptService

1 answer

Log in to vote
1
Answered by 5 years ago

Unfortunately you can not send a system message from a regular script. It must be called from a localscript. What you can do is have a localscript inside starter player scripts (or StarterGui) that listens for a remote event. Here's how I'd approach it (Untested):

01-- Local Script (game.StarterPlayer)
02local event = game:GetService("ReplicatedStorage"):FindFirstChild("ServerMessage")
03if nil == event then
04    repeat
05        event = game:GetService("ReplicatedStorage"):WaitForChild("ServerMessage", 10)
06        wait(0.1)
07    until nil ~= event
08end
09event.OnClientEvent:Connect(function(message, font, font_size, brick_color)
10    brick_color, font, font_size = brick_color or BrickColor.new("Dark stone grey"), font or Enum.Font.Cartoon, font_size or  Enum.FontSize.Size96
11    game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", {
12        Text = tostring(message or "Hello World"),
13        Font = font,
14        Color = brick_color.Color,
15        FontSize = font_size
16    })
17end)
01-- Script in ServerScriptService
02function SystemMessage(...)
03    spawn(function()
04        local event = game:GetService("ReplicatedStorage"):FindFirstChild("ServerMessage")
05        if nil == event then
06            event = Instance.new("RemoteEvent", game:GetService("ReplicatedStorage"))
07            event.Name = "ServerMessage"
08            wait(1.25)
09        end
10        if nil ~= event then
11            event:FireAllClients(...)
12        end
13    end)
14end
15 
16SystemMessage("Lz was here")
0
ok so i have to make an event for that so when in my script its not found i have to fire that event User#27824 0 — 5y
0
There are countless variations but basically, yes. LucarioZombie 291 — 5y
Ad

Answer this question