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
local ChatSettings = require(game.Chat:WaitForChild('ClientChatModules').ChatSettings) ChatSettings.WindowResizable = true; ChatSettings.DefaultFont = Enum.Font.SciFi; ChatSettings.ChatBarFont = Enum.Font.SciFi;
Make a ServerScript
in ServerScriptService
and put this code in (change values as nessacary shown in the comments!)
local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner"):WaitForChild("ChatService")) local groupId = 000000 -- Group ID here game.Players.PlayerAdded:Connect(function(player) while not ChatService:GetSpeaker(player.Name) do wait() end -- Wait till the player's speaker (thing that allows it to chat) exists local speaker = ChatService:GetSpeaker(player.Name) 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 speaker:SetExtraData("Tags", {{TagText = player:GetRoleInGroup(groupId), TagColor = Color3.fromRGB(0, 255, 0)}}) -- Change the values in Color3.fromRGB() for a different tag color end)
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!)
local sendPopup = game.ReplicatedStorage.SendWhisperChatPopup -- Reference a remote event local TextService = game:GetService("TextService") -- Filter messages so they have no swears local function Run(ChatService) local function filterMessage(message, speaker, reciever) local filteringResult = TextService:FilterStringAsync(message, speaker.UserId) if not game.Chat:CanUserChatAsync(speaker.UserId) or not game.Chat:CanUserChatAsync(reciever.UserId) or not game.Chat:CanUsersChatAsync(speaker.UserId, reciever.UserId) then -- Player(s) cannot chat, send back a DONT SEND MESSAGE prompt return 0 end return filteringResult:GetChatForUserAsync(reciever.UserId) end local function whisperCheck(speakerName, message, channelName) if string.sub(channelName, 1, 2) == "To" then -- If whisper channel then local otherPlayer = game.Players:FindFirstChild(string.sub(channelName, 4)) -- Get the other player local speakerPlayer = game.Players:FindFirstChild(speakerName) -- Get the player who said something local newMessage local succ, err = pcall(function() newMessage = filterMessage(message, speakerPlayer, otherPlayer) end) if newMessage == 0 then -- Player can't chat sendPopup:FireClient(speakerPlayer, "Note", "One of you can't chat!") return true end if err then sendPopup:FireClient(speakerPlayer, "Filtering failure", err) return true end -- We can send message sendPopup:FireClient(otherPlayer, speakerName, newMessage) return true end return false end ChatService:RegisterProcessCommandsFunction("whisperCheck", whisperCheck) end return Run
ScreenGui
in StarterGui
LocalScript
into the ScreenGui
and put this in it (remember to reference the remote event you made earlier where you need to!)local inSession = false -- if another chat is on screen local START_POS = UDim2.new(0, -300, 1, 0) local END_POS = UDim2.new(0, 0, 1, 0) local SIZE = UDim2.new(0, 200, 0, 50) local ANCHOR_POINT = Vector2.new(0,1) local TIME = 0.2 local doneEvent = Instance.new("BindableEvent", script.Parent) local function showLabel(speakerName, message) if not inSession then inSession = true local label = Instance.new("TextLabel", script.Parent) label.Name = "WhisperBox" label.BackgroundColor3 = Color3.fromRGB(0,0,0) label.BackgroundTransparency = 0.5 label.BorderSizePixel = 0 label.Font = Enum.Font.SciFi label.TextScaled = true label.TextColor3 = Color3.fromRGB(255,255,255) label.AnchorPoint = ANCHOR_POINT label.Position = START_POS label.Size = SIZE label.Text = speakerName..": "..message label:TweenPosition(END_POS, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, TIME, true) wait(5 + TIME) label:TweenPosition(START_POS, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, TIME, true) wait(TIME) label:Destroy() label = nil inSession = false doneEvent:Fire() else doneEvent.Event:Wait() showLabel(speakerName, message) end end game.ReplicatedStorage.SendWhisperChatPopup.OnClientEvent:Connect(showLabel)
I tested it and it works!