So, I've been trying to make it so that a trainer can open a gui and then press a button to swap the map on my game. My game is FE tho, so I had to use remoteevents to do it. The issue is, whenever I try to switch the map, it doesn't work.
Server Code:
game.ReplicatedStorage.MapChange.OnServerEvent:Connect(function(plr,mapName,teams)
if teams then
for i,v in pairs(game.ServerStorage.Teams:GetChildren()) do
if v.Name == "Red" or v.Name == "Blue" then
v.Parent = game.Teams
end
end
else
for i,v in pairs(game.Teams:GetChildren()) do
if v.Name == "Red" or v.Name == "Blue" then
v.Parent = game.ServerStorage.Teams
end
end
end
local program = workspace.Program:FindFirstChildOfClass("Model")
if program ~= nil then
program.Parent = game.ServerStorage.Programs
end
program = game.ServerStorage.Programs[mapName]
program.Parent = workspace.Program
end)
Client Code:
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.MapChange:FireServer("Obby",false) --This would change depending on the map
end)
Am I doing anything wrong here?

2 comments
Teams is his third argument in the event. It's provided false on Client firing.
Sorry^ couldn’t see it in mobile...