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
game.Players.PlayerAdded:Connect(function(player)
while not ChatService:GetSpeaker(player.Name) do wait() end
local speaker = ChatService:GetSpeaker(player.Name)
if player:GetRoleInGroup(groupId) == "Guest" then return end
speaker:SetExtraData("Tags", {{TagText = player:GetRoleInGroup(groupId), TagColor = Color3.fromRGB(0, 255, 0)}})
end)
For the whisper chat (do this pre-runtime)(anytime i bold a name you must write it just like that):
- Insert a
Folder into Chat called "ChatModules"
- Insert a
BoolValue into **ChatModules** called "InsertDefaultModules" and set it's value to true
- 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
local TextService = game:GetService("TextService")
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
return 0
end
return filteringResult:GetChatForUserAsync(reciever.UserId)
end
local function whisperCheck(speakerName, message, channelName)
if string.sub(channelName, 1, 2) == "To" then
local otherPlayer = game.Players:FindFirstChild(string.sub(channelName, 4))
local speakerPlayer = game.Players:FindFirstChild(speakerName)
local newMessage
local succ, err = pcall(function() newMessage = filterMessage(message, speakerPlayer, otherPlayer) end)
if newMessage == 0 then
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
sendPopup:FireClient(otherPlayer, speakerName, newMessage)
return true
end
return false
end
ChatService:RegisterProcessCommandsFunction("whisperCheck", whisperCheck)
end
return Run
- Next, make a
ScreenGui in StarterGui
- Insert a
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
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!
11 comments
https://www.roblox.com/games/1401417393/Ragdoll-System-Test
Honestly, even if I could make it where it gave people a tag stating they were in the group would be nice.
im trying to see, wait
alright
Nearly forgot, its in a local script.
im trying to figure out a solution, but studio isn't loading my places so i cant do anything
Do you have a discord? If so, add me MillerrIAm#9898
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 [???]
game.Players.PlayerAdded calls are not working i think roblox is actually broken todya
Oh jesus
your local script works fine