Hi devs,
I have a command that our moderators can use to disguise themselves as a normal player with a certain rank, but it doesn’t seem to be working.
Script: (client sided)
local textChatService = game:GetService("TextChatService")
local players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local chatWindowConfiguration = textChatService.ChatWindowConfiguration
local bindable = ReplicatedStorage:WaitForChild("Events"):WaitForChild("Other"):WaitForChild("DisguiseMod")
local function getPlayerName(player: Player)
return player.Name
end
local Tags = {
[255] = {"<font color='#d54e50'><b>[Owner]</b></font>", "<font color='#d54e50'>%s:</font>"},
[9] = {"<font color='#d54e50'><b>[Manager]</b></font>", "<font color='#d54e50'>%s:</font>"},
[8] = {"<font color='#bc49ff'><b>[Developer]</b></font>", "<font color='#bc49ff'>%s:</font>"},
[7] = {"<font color='#00c3ff'><b>[Admin]</b></font>", "<font color='#00c3ff'>%s:</font>"},
[6] = {"<font color='#ff8902'><b>[Moderator]</b></font>", "<font color='#ff8902'>%s:</font>"},
[5] = {"<font color='#ff77ed'><b>[Translator]</b></font>", "<font color='#ff77ed'>%s:</font>"},
[4] = {"<font color='#ff77ed'><b>[Contributor]</b></font>", "<font color='#ff77ed'>%s:</font>"},
[3] = {"<font color='#a7ff34'><b>[Friend]</b></font>", "<font color='#a7ff34'>%s:</font>"},
[2] = {"<font color='#a7ff34'><b>[Partner]</b></font>", "<font color='#a7ff34'>%s:</font>"},
[1] = {"<font color='#a7ff34'><b>[Gang]</b></font>", "<font color='#a7ff34'>%s:</font>"}
}
textChatService.OnIncomingMessage = function(message: TextChatMessage)
local properties = Instance.new("TextChatMessageProperties")
if message.TextSource then
local player = players:GetPlayerByUserId(message.TextSource.UserId)
if player then
local playerName = getPlayerName(player)
local rankInGroup = player:GetRankInGroup(8423759)
if Tags[rankInGroup] then
local prefix = Tags[rankInGroup][1]
local formattedMessage = string.format(Tags[rankInGroup][2], playerName)
properties.PrefixText = prefix .. " " .. formattedMessage
end
end
end
return properties
end
bindable.OnClientEvent:Connect(function(executor, toggle, rank)
local playerName = getPlayerName(executor)
print("Executor Name:", playerName)
print("Toggle:", toggle)
print("Rank:", rank)
local properties = Instance.new("TextChatMessageProperties")
if toggle then
if rank == "Guest" then
properties.PrefixText = string.format("%s:", playerName)
print("Rank set to Guest.")
elseif rank == "Gang" then
if Tags[1] then
local prefix = Tags[1][1]
local formattedMessage = string.format(Tags[1][2], playerName)
properties.PrefixText = prefix .. " " .. formattedMessage
print("Rank set to Gang.")
end
elseif rank == "Partner" then
if Tags[2] then
local prefix = Tags[2][1]
local formattedMessage = string.format(Tags[2][2], playerName)
properties.PrefixText = prefix .. " " .. formattedMessage
print("Rank set to Partner.")
end
elseif rank == "Friend" then
if Tags[3] then
local prefix = Tags[3][1]
local formattedMessage = string.format(Tags[3][2], playerName)
properties.PrefixText = prefix .. " " .. formattedMessage
print("Rank set to Friend.")
end
end
else
if rank == nil then
local rankInGroup = executor:GetRankInGroup(8423759)
print("Rank in Group:", rankInGroup)
if Tags[rankInGroup] then
local prefix = Tags[rankInGroup][1]
local formattedMessage = string.format(Tags[rankInGroup][2], playerName)
properties.PrefixText = prefix .. " " .. formattedMessage
print("Reverted to original rank.")
end
end
end
print("Properties:", properties.PrefixText)
end)
Output: (toggled on with the rank “Gang”)
16:59:06.484 Executor Name: TeamDreams123 - Client - ChatTags:49
16:59:06.484 Toggle: true - Client - ChatTags:50
16:59:06.484 Rank: Gang - Client - ChatTags:51
16:59:06.484 Rank set to Gang. - Client - ChatTags:64
16:59:06.484 Properties: <font color='#a7ff34'><b>[Gang]</b></font> <font color='#a7ff34'>TeamDreams123:</font> - Client - ChatTags:94
Please help.