Creating whitelist/blacklist

I am having trouble creating a whitelist/blacklist I’ve just been confusing myself. I think my conditions may be messed up. I want to make it also that if the character is whitelisted, but they are on the blacklist then the blacklist will override and return.


Whitelist = {player.Character.Parent.Parent},
Blacklist = {player.Character},

if prompt:FindFirstChild("Whitelist") then
        for _,instance in pairs(prompt.Whitelist:GetChildren()) do
            if character:IsDescendantOf(instance.Value) == false or character ~= instance.Value then
                print(instance.Value)
                return
            end
        end
    end
    
    if prompt:FindFirstChild("Blacklist") then
        for _,instance in pairs(prompt.Blacklist:GetChildren()) do
            if character:IsDescendantOf(instance.Value) == true or character == instance.Value then
                print(instance.Value)
                return
            end
        end
    end

I’m seeing some issues in your code. First of all, in the “Whitelist” table, you’re putting player.Character.Parent.Parent, which is the game. As for your issue, a simple

if Whitelist[player.Character] then return end

inside the blacklist function should work. LMK if this works

Not in my game. This represents the team they are in. Thus, only people on their team can use this.

I’m a little confused here. What are you trying to do? Make it so only one team can use a Proximity Prompt?

Yes. That’s exactly what I’m trying to do, and I want it to be hidden to one player.

Does that player stay constant or do you want to change who it’s hidden to?

The player stays constant. Each “instance” is simply an object value.

You could just use a remote event and fire it to the client you want to hide it from. Then you can destroy it on the client when it receives the remote event.

I fail to see why in any world I would do that but thank you for the feedback.

Are you doing it on the client right now? Because if you want to completely hide the proximity prompt, there’s no other way than doing it from the client.