Transform function error Callbacks cannot yield

im tryna send a global chat message whenever somebody donates robux but it doesnt work

code:

MessagingService:SubscribeAsync("Global", function(msg)
	ReplicatedStorage.Events.Chat:FireAllClients(msg.Data[1])
end)

for i, v in pairs(workspace.Spawn.TimePadsBoard.SurfaceGui.Stats.Donate.ScrollingFrame:GetChildren()) do
	if v:IsA("TextButton") then
		productFunctions[v.ProductID.Value] = function(receipt, player)
			player.Data.RobuxDonated.Value += string.sub(v.Name,7)
			local Message = "[GLOBAL] " .. player.Name .. " donated " .. string.sub(v.Name,7) .. " robux! Thank you!"
			print(Message)
			MessagingService:PublishAsync("Global", Message)
			return true
		end
	end
end

it actually prints out the intended text but it fails at publish async

publishAsync is making the code fail because it makes the code yield
you could maybe use coroutines and have the publishAsync on a separate thread
but you should also make sure errors are handled properly when that happens