You can write your topic however you want, but you need to answer these questions:
I would like to make a banned area were everyone can enter but you can ban some people from entering. (Not like a command like in the script we would just do “user1”, “user2” etc
I am not sure if I can do this or not.
I have looked it up and found nothing.
Not asking for a script. Just asking if I can do this or not and some pointers.
Right, so make a new collision group. Make it only collide with itself.
Make a “BlacklistArea” group
Make a “BlacklistPlayers” group
Make them collide with each other. Make BlacklistPlayers also collide with everything that Default collides with.
Add the “area part” to the BlacklistArea group
Add the blacklisted players to the BlacklistPlayers group
Done!
For example, given these groups:
You could add a part in workspace and do something like this
local players = game:GetService("Players")
local physicsService = game:GetService("PhysicsService")
local area = workspace.Part
physicsService:SetPartCollisionGroup(area, "BlacklistArea")
local banned = {
["nicemike40"] = true,
["chrisfs123"] = true,
}
local function addToBlacklistGroup(part)
if part:IsA("BasePart") then
physicsService:SetPartCollisionGroup(part, "BlacklistPlayers")
end
end
local function onCharacterAdded(character)
for _, part in pairs(character:GetDescendants()) do
addToBlacklistGroup(part)
end
character.DescendantAdded:Connect(addToBlacklistGroup)
end
local function onPlayerAdded(player)
if banned[player.Name] then
if player.Character then
onCharacterAdded(player.Character)
end
player.CharacterAdded:Connect(onCharacterAdded)
end
end
players.PlayerAdded:Connect(onPlayerAdded)
@chrisfs123 I would recommend using collision group(which is used in the article Restricted/TeamDoors) and fire a event when a player joined where if they are on the black list assign them a black listed collision group
Just make a table of players who cannot walk in the area (data save if you want) then create a Region3 around the area and every so often loop through the players inside the region, and ban them.
You could give the players that you want banned a certain value that is saved/given to them. Then you can create a zone by using a part that will check if a player has that value using part.Touched:Connect(function(hit [or whatever you want to call this] ))