hey I need help with this lua script BadgeID = {2125124983, 2125125002, 2125125011,…
- User
hey I need help with this lua script BadgeID = {2125124983, 2125125002, 2125125011, 2125141376, 2125141381, 2125241771, 2125241773, 2125242175, 2125271854, 2125271858, 2125271863, 2125271868, 2125271871, 2145784586, 2145784595, 2145784605, 2145784617} --Change to the Badges ID GroupID = 5587275 --Group ID (Badgers Of Robloxia is already filled out) game.Players.PlayerAdded:connect(function(p) if p:IsInGroup(GroupID) then game:GetService("BadgeService"):AwardBadge(p.userId,BadgeID) end end)
it only reads the first badge id
- Assistant
The reason why the script only reads the first badge ID is that the game:GetService("BadgeService"):AwardBadge(p.userId,BadgeID) requires a single badge ID as the second argument, not an array of multiple badge IDs.
To fix this issue, you can modify the script to loop through the BadgeID array and call the AwardBadge method for each badge ID:
BadgeID = {2125124983, 2125125002, 2125125011, 2125141376, 2125141381, 2125241771, 2125241773, 2125242175, 2125271854, 2125271858, 2125271863, 2125271868, 2125271871, 2145784586, 2145784595, 2145784605, 2145784617} --Change to the Badges ID GroupID = 5587275 --Group ID (Badgers Of Robloxia is already filled out) game.Players.PlayerAdded:connect(function(p) if p:IsInGroup(GroupID) then for i = 1, #BadgeID do game:GetService("BadgeService"):AwardBadge(p.userId, BadgeID[i]) end end end)
- User
hey I need help with this lua script BadgeID = {2125124983, 2125125002, 2125125011, 2125141376, 2125141381, 2125241771, 2125241773, 2125242175, 2125271854, 2125271858, 2125271863, 2125271868, 2125271871, 2145784586, 2145784595, 2145784605, 2145784617} --Change to the Badges ID GroupID = 5587275 --Group ID (Badgers Of Robloxia is already filled out) game.Players.PlayerAdded:connect(function(p) if p:IsInGroup(GroupID) then game:GetService("BadgeService"):AwardBadge(p.userId,BadgeID) end end)
it only reads the first badge id
- Assistant
The reason why the script only reads the first badge ID is that the game:GetService("BadgeService"):AwardBadge(p.userId,BadgeID) requires a single badge ID as the second argument, not an array of multiple badge IDs.
To fix this issue, you can modify the script to loop through the BadgeID array and call the AwardBadge method for each badge ID:
BadgeID = {2125124983, 2125125002, 2125125011, 2125141376, 2125141381, 2125241771, 2125241773, 2125242175, 2125271854, 2125271858, 2125271863, 2125271868, 2125271871, 2145784586, 2145784595, 2145784605, 2145784617} --Change to the Badges ID GroupID = 5587275 --Group ID (Badgers Of Robloxia is already filled out) game.Players.PlayerAdded:connect(function(p) if p:IsInGroup(GroupID) then for i = 1, #BadgeID do game:GetService("BadgeService"):AwardBadge(p.userId, BadgeID[i]) end end end)
- User
BadgeID = {2125124983, 2125125002, 2125125011, 2125141376, 2125141381, 2125241771, 2125241773, 2125242175, 2125271854, 2125271858, 2125271863, 2125271868, 2125271871, 2145784586, 2145784595, 2145784605, 2145784617} --Change to the Badges ID GroupID = 5587275 --Group ID (Badgers Of Robloxia is already filled out) game.Players.PlayerAdded:connect(function(p) if p:IsInGroup(GroupID) then game:GetService("BadgeService"):AwardBadge(p.userId,BadgeID) end end)
- Assistant
The issue with this script is that it passes an array of Badge IDs as the second argument to the AwardBadge method. However, the AwardBadge method requires a single badge ID.
To fix this issue, you can modify the script to loop through the BadgeID array and call the AwardBadge method for each badge ID:
BadgeID = {2125124983, 2125125002, 2125125011, 2125141376, 2125141381, 2125241771, 2125241773, 2125242175, 2125271854, 2125271858, 2125271863, 2125271868, 2125271871, 2145784586, 2145784595, 2145784605, 2145784617} --Change to the Badges ID GroupID = 5587275 --Group ID (Badgers Of Robloxia is already filled out) game.Players.PlayerAdded:connect(function(p) if p:IsInGroup(GroupID) then for i = 1, #BadgeID do game:GetService("BadgeService"):AwardBadge(p.userId,BadgeID[i]) end end end)
This will award each badge in the BadgeID array to players who are in the specified group.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.