EventHandler stops working in multiplayer

I have an EventHandler script and when I do it with nobody else on the server it works but in team tests it stops working and I don’t know why… I don’t even need anyone else in.

local events = game.ReplicatedStorage.Events
local MessagingService = game:GetService('MessagingService')

local function DisplayMessage(input)
	local Slow = string.split(input, '')
	for i, Player in ipairs(game.Players:GetPlayers()) do
		task.spawn(function()
			local Message = Player.PlayerGui.MessageUI.Frame.Message

			Message.Parent.Parent.Enabled = true

			Message.Text = ''

			for i, Letter in ipairs(Slow) do
				Message.Text = Message.Text .. Letter
				wait(0.1)
			end

			wait(3)

			Message.Parent.Parent.Enabled = false
		end)
	end
end

MessagingService:SubscribeAsync('ServerMessages', function(message)
	message = message.Data
	
	DisplayMessage(message)
end)

events.ServerMessage.OnServerEvent:Connect(function(player, message)
	MessagingService:PublishAsync('ServerMessages', message)
end)

events.Buy.OnServerEvent:Connect(function(plr, item, price)
	if plr:FindFirstChild('leaderstats').Coins.Value > price - 1 then
		if game.Lighting.Tools:FindFirstChild(item) then
			plr:FindFirstChild('leaderstats').Coins.Value -= price
			game.Lighting.Tools:FindFirstChild(item):Clone().Parent = plr.Backpack
			print(plr.Name .. ' Has Bought A ' .. item .. ' For ' .. price .. ' Coins')
		end
	end
end)

events.Give.OnServerEvent:Connect(function(plr, tool)
	local clone = tool:Clone()
	
	clone.Parent =  plr.Backpack
end)

events.Message.OnServerEvent:Connect(function(plr, input: string)
	DisplayMessage(input)
end)

events.Coin.OnServerEvent:Connect(function(plr, input)
	local player = workspace:FindFirstChild(plr.Name)
	
	for i=1, input do
		wait(0)
		local coin = workspace.Map:FindFirstChild('Coins'):FindFirstChild('Coin'):Clone()
		
		coin.Parent = workspace
		coin.Position = player:FindFirstChild('Head').Position
	end
end)

events.CloseAdmin.OnServerEvent:Connect(function(plr)
	plr.PlayerGui.Admin.Enabled = false
end)

events.Kick.OnServerEvent:Connect(function(plr, Player, Msg)
	game.Players:FindFirstChild(Player):Kick(Msg)
end)

events.GiveCoins.OnServerEvent:Connect(function(plr, Who, Amount)
	game.Players:FindFirstChild(Who):FindFirstChild('leaderstats'):FindFirstChild('Coins').Value += Amount
end)

events.ForcePlace.OnServerEvent:Connect(function(plr, target, ID)
	local player = game.Players:FindFirstChild(target)
	if target == 'all' then
		player = game.Players:GetChildren()
	end
	
	if ID == 'Maze' then
		if target == 'all' then
			game:GetService('TeleportService'):TeleportPartyAsync(16045281967, player)
		else
			game:GetService('TeleportService'):Teleport(16045281967, player)
		end
	else
		if target == 'all' then
			game:GetService('TeleportService'):TeleportPartyAsync(ID, player)
		else
			game:GetService('TeleportService'):Teleport(ID, player)
		end
	end
end)

events.SetLevel.OnServerEvent:Connect(function(plr, level)
	plr:FindFirstChild('leaderstats'):FindFirstChild('Level').Value = level
end)

Is there an error message you get in the output?
It’s possible that the Script is ran before the Events folder is created, or before one of the RemoteEvents is created, but without an error message I can’t be sure

no error message but I could add a wait for child function to it… It has the wait for child function on it now

Try adding a print statement to the beginning of the script and at the very end, and check if it is getting printed out in team test

You cannot access the PlayerGui from the server, fire an UnreliableRemoteEvent to make GUI changes on the client instead

I know it fires the event I have a logger for it