generally, I wanna make a blacklist script. If the player is in a group from a module list, the reason text will change to the reason the group is in the module
module
local group = {
{group = "group", reason = "cool", groupId = 123},
}
return group
local GroupList = require(script.GroupList)
local Player = game:GetService("Players").LocalPlayer
local Group = script.Parent.Group
local Reason = script.Parent.Reason
if isInBlacklist then
Player.PlayerGui.Scoreboards:Destroy()
Player.PlayerGui.PlayerList:Destroy()
Player.PlayerGui.Start:Destroy()
Player.Backpack:ClearAllChildren()
script.Parent.Header.Text = "BLACKLISTED"
Group.Text = "You cannot access this game"
Reason.Text = "You have been blacklisted. Reason: " .. blacklistedGroup.reason
end
Can anyone modify this script to that if player is in the groups that are in the module, it shows the frame with the group ID and the groups reason for blacklist?
local GroupList = require(script.GroupList)
local Player = game:GetService("Players").LocalPlayer
local Group = script.Parent.Group
local Reason = script.Parent.Reason
local blacklistedGroup
for _,v in ipairs(GroupList) do
if Player:IsInGroup(v.groupId) then
blacklistedGroup = v
end
end
if blacklistedGroup then
Player.PlayerGui.Scoreboards:Destroy()
Player.PlayerGui.PlayerList:Destroy()
Player.PlayerGui.Start:Destroy()
Player.Backpack:ClearAllChildren()
script.Parent.Header.Text = "BLACKLISTED"
Group.Text = "You cannot access this game"
Reason.Text = "You have been blacklisted. Reason: " .. blacklistedGroup.reason
end
You can loop through every group and check if the player is in each group.
Code:
local GroupList = require(script.GroupList)
local Player = game:GetService("Players").LocalPlayer
local Group = script.Parent.Group
local Reason = script.Parent.Reason
local blacklistedGroup = nil
for i, groupData in ipairs(GroupList) do
if Player:IsInGroup(groupData.groupId) then
blacklistedGroup = groupData
break
end
end
if blacklistedGroup then
Player.PlayerGui.Scoreboards:Destroy()
Player.PlayerGui.PlayerList:Destroy()
Player.PlayerGui.Start:Destroy()
Player.Backpack:ClearAllChildren()
script.Parent.Header.Text = "BLACKLISTED"
Group.Text = "You cannot access this game"
Reason.Text = "You have been blacklisted. Reason: " .. blacklistedGroup.reason
end