local marketplaceService = game:GetService('MarketplaceService')
local replicatedStorage = game:GetService('ReplicatedStorage')
local functions = replicatedStorage:WaitForChild('Functions')
local chatChecker = functions:WaitForChild('ChatChecker')
local function returnInfo(player, actual, id, place, rank)
if place == 'Pass' then
if marketplaceService:UserOwnsGamePassAsync(actual.userId, id) then
return true
else
return false
end
else
if actual:IsInGroup(id) then
return actual:GetRankInGroup(id)
else
return 0
end
end
end
chatChecker.OnServerInvoke = returnInfo
Below script is a separate script
-- ModuleScript in chat --
function sendInfo(player)
local info = saves[player.UserId]
if not info then
local priority = 0
for key, value in pairs(ranks) do
if chatChecker:InvokeServer(player, 3598451, 'Group', key) == 255 and value.priority > priority then
info = {title = value.title, color = value.color, color0 = value.color0}
priority = value.priority
print(player.Name .. ' = Creator')
elseif chatChecker:InvokeServer(player, 3598451, 'Group', key) == 195 and value.priority > priority then
info = {title = value.title, color = value.color, color0 = value.color0}
priority = value.priority
print(player.Name .. ' = Mod')
end
end
if info == nil then
info = 'placeholder'
end
saves[player.UserId] = info -- saves title info for easy reference
return info
else
return info
end
end
return sendInfo
These 2 scripts are in separate parts, and I’ve cut all the irrelevant stuff out of them (well to my knowledge at least) I believe the problem is inside the module script. I am trying to create tags for players in my group. So on the script at the top it checks to see if they are in the group, if not then it returns 0 (not in group/guest), if they are though it then returns their rank within the group (when I join it returns 255)
However in the module script, I have the lines to check what’s being returned by the RemoteFunctions, whether the number is 255 or 195. Now as I said before, it prints 255 when I chat, so it’s returning 255 for me, but it still gives me the mod rank (195).
I’m not sure if it has something to do with the metatable at the top of the modulescript? maybe because they all contain the same key (the group id). Any help would be greatly appreciated
EDIT
I added prints, and it turns out that when each player chats it’s putting them in the right ‘position’ in the script. So if someone is rank 195, it prints their name = Mod, and if I chat it prints NinjoOnline = Creator. So the problem must be on this line:
info = {title = value.title, color = value.color, color0 = value.color0}
For some reason, whether the RemoteFunction returns as 255, or 195, it will always give that same info. Since there’s 2 info variables, it should theoretically give the second key for the 195 return.
Thank you,
Ninjo