Hello! I am trying to make a UI to change teams when a button is pressed. I have a "for i, v in pairs()" loop to cycle through all of the buttons, and when v is pressed, it should fire a remote event with the value of an object value in the button (v) that was pressed. I know the clicking script works because I prints "clicked" when I press a button, but on the normal script that fires when the event is fired, there is no output in the console, though it should print "fired" when the event is fired. Sorry if I'm bad at explaining, but there are code snippets below that should explain my error.
The script that fires the event when a button is pressed
local frame = script.Parent
b = {
frame.Medics;
frame.Class_D;
frame.Chaos_Insurgency;
frame.Scientists;
frame.Security;
frame.Mobile_Task_Force;
}
for i, v in pairs(b) do
v.MouseButton1Click:Connect(function()
print("clicked")
game:GetService("ReplicatedStorage").Events.ChangeTeam:FireServer(v.Team.Value)
end)
end
the script that fires when the event is fired
local event = game:GetService("ReplicatedStorage").Events.Sirens
event.OnServerEvent:Connect(function(player, team)
print("fired")
if team ~= nil then
if team:IsA("Team") then
player.Team = team
else
warn("Argument 2 is not a team model. Code did not compile.")
end
else
warn("Argument 2 missing or nil. Code did not compile.")
end
end)
when i press a button, "clicked" is put in the output, but "fired" isn't. This is my issue, the event isn't getting fired for whatever reason. There are no errors in the output

1 comment
Thanks! It's like 12:15 AM and im brain dead so it would of taken me a while to find that on my own. thanks!