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);
@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…
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.
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;