Interaction not working?

Hello all! I am trying to fix this interaction script, where when you press the letter E an event will be fired for a UI to pop up. However, for some reason when I am on the team required for the interaction to clone, it doesn’t. But, for a different team it does . Can someone take a look and see if they can help me?

local interactions = {};
local players = game:GetService('Players');
local localPlayer = players.LocalPlayer;
local interaction = require(script:WaitForChild('interactionModule'));

setInteraction('PDCar', function(part)
    interactions[#interactions + 1] = newInteraction(part, 'Spawn Car', EKeyCode, function() carSpawnerEvent:FireServer('Display', 'PD'); end, {
    condition = function()
        return localPlayer.Team.Name == 'PD Team';
    end
    });
end);

It appears, according to this, that the Team property of Player is not replicated to the client.

Edit: I have not tested this.

I will test it out, but for other functions it works…weird

@MattPrograms I do not think that is the issue, as it works for others. I forgot to add this, but the interaction only adds when I joined a different team…

I can’t really help much without knowing the context of the interactionModule.

What’s there to know? It checks if a player is on team, takes a child from InteractionModule, moves it into the part, and then it appears. However, it only appears when the user is on the RCMP team.

Where is interactions, setInteraction, and newInteraction defined?

To add to @MattPrograms says, it’s generally less of a headache to use TeamColor instead.

1 Like

ill send

local interactions = {};
local newInteraction = interaction.new;
local function setInteraction(tag, callback)
    for i, v in next, collectionService:GetTagged(tag) do
        callback(v);
    end;
    collectionService:GetInstanceAddedSignal(tag):Connect(function(obj)
        callback(obj);
    end);
    collectionService:GetInstanceRemovedSignal(tag):Connect(function(obj)
        for i, v in next, interactions do
            if v.part == obj then
                tableRemove(interactions, i);
                v.interactGUI:Destroy();
                v.callback = nil;
            end;
        end;
    end);
end;

@MattPrograms

I don’t think that’s the issue.