How do I get all of the members of a Team Create/Collaboration in a game, and put it into a table?
I’m trying to make a “Met A Dev” badge, but I don’t want to have to manually input every tester and developer into a table.
I’d say something like this?
local players = game:GetService("Players")
local teams = game:GetService("Teams")
local playerInTeam = {}
players.PlayerAdded:Connect(function(player)
if player.Team == teams["InsertTeamName"] then
table.insert(playerInTeam, player)
print(playerInTeam)
-- add more code if you want to
else
print("not in team")
end
end)
not like that, he meant TEAM CREATE where you EDIT GAMES in ROBLOX STUDIO together with OTHER PEOPLE at the SAME TIME using DIFFERENT DEVICES
sorry about that
Ok ok, changed it, here:
local IdsOfCollaborators = {} -- paste ids of people who built with
local players = game:GetService("Players")
local BadgeService = game:GetService("BadgeService")
local BadgeId = 219789231 -- paste ur badge id here
function hasBadge(playerId, id)
local success, hasBadge = pcall(function()
return BadgeService:UserHasBadgeAsync(playerId, id)
end)
end
players.PlayerAdded:Connect(function(player)
for i = 1, #IdsOfCollaborators do
if player.UserId == IdsOfCollaborators[i] then
for index, plr in pairs(game.Players:GetChildren()) do -- change it to :GetPlayers() if it doesnt award badge
local hasBadge = hasBadge(plr.UserId, BadgeId)
if not hasBadge then
BadgeService:AwardBadge(plr.UserId, BadgeId)
end
end
end
end
end)
He just said he doesn’t want to manually input every tester and developer into a table:
…
This text will be blurred
I literally don’t have any idea on how that would be possible. If you know it, go ahead. And I’m pretty sure (without a plugin, if there even is one) that might be just impossible. Only thing that might be possible, is to make a group and check what Rank they are.
I thought there would be some sort of API or Service that did this, but I guess there isn’t.
It looks like there is an API develop.roblox.com/v1/universes/{universeId}/teamcreate/memberships
for fetching the Team Create collaborators of a universe, but it needs authentication.
There is another API develop.roblox.com/v1/user/{userId}/canmanage/{assetId}
that checks if a user can manage an asset (Roblox uses this in CoreScripts) and it doesn’t require you to be authenticated. Use game.PlaceId
for the assetId
parameter. You need a proxy to do it but you can make a request whenever a new player joins to determine if they’re a developer. I’ve tested it out by changing someone’s permission from Play to Edit and the canmanage
API reflected that immediately.
what do you mean by authentication?
sorry for the late reply, forgot to check devforum!
Sending a ROBLOSECURITY cookie with a request authenticates it to originate from a logged in user account. Some endpoints require this cookie so someone doesn’t see or change something without permission.
This cookie shouldn’t be shared. It can allow anybody to become you on Roblox. Since you need a proxy to launch these requests in-game, you’d be forced to share the cookie with the proxy server if you’re authenticating a request. That’s part of the reason there’s advice about self hosting proxies.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.