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

Anyone know anything about the ChatSystem? I don't understand it at all..

Asked by 5 years ago
Edited 5 years ago

I was at this game called Ragdoll System Test (https://www.roblox.com/games/1401417393/Ragdoll-System-Test) THIS IS JUST FOUR QUESTIONS I'M ASKING FOR ANY SCRIPTERS WHO KNOW ABOUT THE CHATSYSTEM AND HOW IT WORKS I saw that if you whisper someone, there is a special box that pops up instead of it being in the general chat. I have two questions.. One) Is this a custom chatsystem & Two) How would this be done? The next question is about chat tags.. is it possible to have it where chat tags can show your group rank? I'm asking because I don't want to put all the time and effort in to do all of this and then I end up finding out that it's not able to be done. Here's the script. game>StarterGui>ChatFont

1local ChatSettings = require(game.Chat:WaitForChild('ClientChatModules').ChatSettings)
2 
3ChatSettings.WindowResizable = true;
4ChatSettings.DefaultFont = Enum.Font.SciFi;
5ChatSettings.ChatBarFont = Enum.Font.SciFi;
0
Honestly, even if I could make it where it gave people a tag stating they were in the group would be nice. Just2Terrify 566 — 5y
0
im trying to see, wait throwawayaccount2001 102 — 5y
0
alright Just2Terrify 566 — 5y
View all comments (7 more)
0
Nearly forgot, its in a local script. Just2Terrify 566 — 5y
0
im trying to figure out a solution, but studio isn't loading my places so i cant do anything throwawayaccount2001 102 — 5y
0
Do you have a discord? If so, add me MillerrIAm#9898 Just2Terrify 566 — 5y
0
i think roblox isn't working right, there is a bar saying so at the top of the home page, i got it to sorta work but it keeps showing [???] throwawayaccount2001 102 — 5y
0
game.Players.PlayerAdded calls are not working i think roblox is actually broken todya throwawayaccount2001 102 — 5y
0
Oh jesus Just2Terrify 566 — 5y
0
your local script works fine throwawayaccount2001 102 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Make a ServerScript in ServerScriptService and put this code in (change values as nessacary shown in the comments!)

01local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
02local groupId = 000000 -- Group ID here
03 
04game.Players.PlayerAdded:Connect(function(player)
05    while not ChatService:GetSpeaker(player.Name) do wait() end -- Wait till the player's speaker (thing that allows it to chat) exists
06    local speaker = ChatService:GetSpeaker(player.Name)
07    if player:GetRoleInGroup(groupId) == "Guest" then return end -- Remove this if you want it to do say [Guest] if they player isn't in the group
08    speaker:SetExtraData("Tags", {{TagText = player:GetRoleInGroup(groupId), TagColor = Color3.fromRGB(0, 255, 0)}})
09    -- Change the values in Color3.fromRGB() for a different tag color
10end)

For the whisper chat (do this pre-runtime)(anytime i bold a name you must write it just like that): 1. Insert a Folder into Chat called "ChatModules" 2. Insert a BoolValue into **ChatModules** called "InsertDefaultModules" and set it's value to true 3. Insert a ModuleScript into ChatModules and put this in the module (make sure to make the remote event that the script references!)

01local sendPopup = game.ReplicatedStorage.SendWhisperChatPopup -- Reference a remote event
02local TextService = game:GetService("TextService") -- Filter messages so they have no swears
03 
04local function Run(ChatService)
05    local function filterMessage(message, speaker, reciever)
06        local filteringResult = TextService:FilterStringAsync(message, speaker.UserId)
07        if not game.Chat:CanUserChatAsync(speaker.UserId) or not game.Chat:CanUserChatAsync(reciever.UserId) or not game.Chat:CanUsersChatAsync(speaker.UserId, reciever.UserId) then
08            -- Player(s) cannot chat, send back a DONT SEND MESSAGE prompt
09            return 0
10        end
11        return filteringResult:GetChatForUserAsync(reciever.UserId)
12    end
13 
14    local function whisperCheck(speakerName, message, channelName)
15        if string.sub(channelName, 1, 2) == "To" then -- If whisper channel then
View all 39 lines...
  1. Next, make a ScreenGui in StarterGui
  2. Insert a LocalScript into the ScreenGui and put this in it (remember to reference the remote event you made earlier where you need to!)
01local inSession = false -- if another chat is on screen
02local START_POS = UDim2.new(0, -300, 1, 0)
03local END_POS = UDim2.new(0, 0, 1, 0)
04local SIZE = UDim2.new(0, 200, 0, 50)
05local ANCHOR_POINT = Vector2.new(0,1)
06local TIME = 0.2
07local doneEvent = Instance.new("BindableEvent", script.Parent)
08 
09local function showLabel(speakerName, message)
10    if not inSession then
11        inSession = true
12        local label = Instance.new("TextLabel", script.Parent)
13        label.Name = "WhisperBox"
14        label.BackgroundColor3 = Color3.fromRGB(0,0,0)
15        label.BackgroundTransparency = 0.5
View all 38 lines...

I tested it and it works!

Ad

Answer this question