How would I make a 'Warn' command?

As of this moment, I’m working on an administration system for my game. How would I go about Inserting a Message Into a Client rather than the entire server? I plan on doing Instance.new(‘Message’, HoweverIGetThisIntoTheClient) and not some custom gui. Thanks! :slight_smile:

3 Likes

fire remote from server to client with message

client calls warn(your_message)

2 Likes

This is not what OP is asking for.

1 Like

I’m thinking more of a Administrator System. Where a player says something along the lines of, ‘;warn player’ then a Message Instance pops up on the target player (the clients) screen. Not a ‘warn(‘Hey Something went wrong!’)’ Kinda deal. :slight_smile:

gane.Players.PlayerAdded:connect(function(plr)

  plr.Chatted:connect(function(msg)
      local prefix = "!"
       local warnmessage = string.sub(msg, startofit, end_of_warn_message);
             if msg == prefix .. warnmessafe then
                    --// Code
             end
    end)

end)

I also recommend using a datastore if you wanna keep player warns on rejoin, and a system where too many warns means you get kicked / banned

this is a basic example, you can make it way better

2 Likes

A custom GUI is superior for many reasons but is not required.

Scripting wise, there are many ways to do this.
My preferred way is with Remote Events.

The server would process the command then use FireClient() to the singular client. From there, the local script would create the message through Instance.new('Message') then you can parent it to wherever on the client.

As for getting the command to process, use the Player.Chatted event on the server to get the command. Then use string.sub to parse the arguments from the message.

5 Likes

Thanks! (: I’ll be doing this method, and thank you everyone for replying! :blush:

1 Like

To achieve the warning message you can use the code below and you’re able to change the Color, Font and FontSize of the text as well. This needs to be client side.

local Message = {}
Message.Text = "[SERVER]: "..Seeker.Name.." found "..Hider.Name
Message.Color = Color3.fromRGB(163, 162, 165)
Message.Font = Enum.Font.SourceSansBold
Message.FontSize = Enum.FontSize.Size18
StarterGui:SetCore("ChatMakeSystemMessage", Message)
4 Likes

That’d be applicable if they were looking for a chat warning or private message. This doesn’t answer the OP.

To speak about your code though, I personally prefer to use the Lua Chat System since it’s really customisable. Using SetCore to send a chat message feels antiquated now. I create server as a ChatSpeaker and then make it send messages.

1 Like

I’ve decided to make a custom gui as it makes more since, though, i’ll be using that code for some other commands! Thanks everyone for responding! :slight_smile:

2 Likes

I made a administration system with a warn command, and it’s a gui. I open sourced it and posted it on DevForums if you wanna use it.

Don’t think this is what OP is looking for

A post was merged into an existing topic: Off-topic and bump posts

1 Like

I’ve made it and got it working. :slight_smile:

1 Like

(I know this topic is quite old, however I think bumping it would be helpful to many people)
How would I go about adding a DataStore to the command? I’m not super familiar with it, so I apologize.

1 Like