So roblox has deprecated chatservice–however I am now noticing there are problems. I need to be able to change over to the newer version but I am quite unsure what I need to replace here.
local Scriptservice = game:GetService("ServerScriptService")
local ChatService = require(Scriptservice:WaitForChild("ChatServiceRunner").ChatService)
local speaker = ChatService:GetSpeaker(SpeakerName)
local player = speaker:GetPlayer()
if player then -- Makes sure the speaker is a real player
local UserId = player.UserId -- Getting the UserId of the speaker
server.Core.GetPlayer(player)
if UserId == 79262008 then
local tags = speaker:GetExtraData("Tags")
if not tags then tags = {} end
for i,t in pairs(tags) do
if t.TagText == ranks["254"].TagText then
table.remove(tags, i)
speaker:SetExtraData("ChatColor", Color3.new(1, 1, 1))
return false
end
end
table.insert(tags, {TagText = ranks["254"].TagText, TagColor = ranks["254"].TagColor})
speaker:SetExtraData("Tags", tags)
speaker:SetExtraData("ChatColor", Color3.fromRGB(205, 244, 250)) -- 245, 50, 50 red -- 205, 244, 250
return true
elseif server.Admin.GetPlayerGroup(player, groupId) then -- If player is in the group, check the rank
local rank = server.Admin.GetPlayerGroup(player, groupId).Rank
for i,tag in pairs(ranks) do -- Loop through the ranks table
if i == tostring(rank) then -- If the rank of the player is in the ranks table, set the tag accordingly
local tags = speaker:GetExtraData("Tags")
if not tags then tags = {} end
for i,t in pairs(tags) do
if t.TagText == tag.TagText then
table.remove(tags, i)
speaker:SetExtraData("ChatColor", Color3.new(1, 1, 1))
return false
end
end
table.insert(tags, {TagText = tag.TagText, TagColor = tag.TagColor})
speaker:SetExtraData("Tags", tags)
speaker:SetExtraData("ChatColor", Color3.fromRGB(205, 244, 250)) -- 245, 50, 50 red -- 205, 244, 250
return true
end
end
end
end
end
end
what I have tried so far is reading through the documentation of textchatservice but it appears that I have no luck whatsoever trying to come up with possible solutions!
here is an error I have ongoing:
GetSpeaker is not a valid member of TextChatService “TextChatService”