Function in module script not running

I am not sure why my function in a module script isn’t running and i’m not sure what is causing it.

so whenever the player clicks play, it will fire an event to the server. When the event is called and the server receives it, it is supposed to run a function in a module script. For some reason, it is not doing that.

All i know is that it isn’t the inRound value, because it is enabling and disabling the Guis.

Script for the play button:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local UI = player.PlayerGui
local round = game.ReplicatedStorage.Round
local inRound = round.inRound
local button = script.Parent

button.MouseButton1Click:Connect(function()
	if inRound.Value == false then return end
	game.ReplicatedStorage.GeneralEvents.TeamChange:FireServer()

	UI.Rounds.Enabled = true
	UI.Menu.Enabled = false
end)

Script on Server:

local TEAM_H = require(script.teamsHandler)
local replicated = game.ReplicatedStorage
local GE = replicated.GeneralEvents
local teamChange = GE.TeamChange

teamChange.OnServerEvent:Connect(TEAM_H.onEvent)

function on module script (the one that isn’t being called because doesn’t print here! ):

function module.onEvent(player)
	print("here!")
	local humRoot = player.Character

	local playersOnRed = redTeam:GetPlayers()
	local playersOnBlue = blueTeam:GetPlayers()
	numberInRed = #playersOnRed
	numberInBlue = #playersOnBlue
	print("here!")
	local function setTeam(team)
		player.Team = game.Teams[team]
		if team == "Red" then
			table.insert(referenceRed, player.Name)
		else
			table.insert(referenceBlue, player.Name)
		end

		for i, v in pairs(workspace:GetChildren()) do
			if v.Name == team then
				humRoot:SetPrimaryPartCFrame(v.CFrame)
			end
		end
	end
	
	print("here!")
	if numberInRed > numberInBlue then
		setTeam("Blue")
	elseif numberInBlue > numberInRed then
		setTeam("Red")
	else
		local randomNumber = math.random(1, 2)
		if randomNumber == 2 then
			setTeam("Red")
		else
			setTeam("Blue")
		end
	end
	print("here!")
	enable:FireClient(player, "Rounds")
	player.Character.Humanoid.WalkSpeed = 16 
end

I have copied Your code roughly and it does work for me. Weird.

You may check if the TeamChange event is not duplicated. Best to check while the game is running, as I once had second event created via script, and server was connected to different one than the client was firing.

Other than that, maybe you have infinite loop in Your server script or module script, that prevent above code from executing? Something like EventThatNeverFires:Wait() also does not produce warnings.

Make sure the module script is called by require from another script

oh yeah i fixed it. sorry for the late reply and yes it was because i had a while loop running on the same script. Thank you for your help!

i already did and i thought i included it in the script