Notification (Solved)

-- Solved
-- Solved

In the second code you provided it only enables it in the StarterGui and not player.PlayerGui. Also instead of using subscribeasync everytime a user joins you should instead call it only once and loop through the players.

I’ve tried this but it still doesnt seem to be working

local messagingServive = game:GetService("MessagingService")
messagingServive:SubscribeAsync("GlobalAnnouncement", function(message)


game.Players.PlayerAdded:Connect(function(player)
	
		local success, errorMessage, connection = pcall(function()

			player.PlayerGui.Announcement.Enabled = true
			player.PlayerGui.Announcement.TextLabel.Text = message.Data

			wait(6)

			player.PlayerGui.Announcement.TextLabel.Text = ""
			player.PlayerGui.Announcement.Enabled = false

		end)

	end)
	
end)


game.Players.PlayerAdded:Connect(function(player)
	
	if player.UserId == 53188363 then
		
		player.Chatted:Connect(function(message)
			
			if message == "Announcement" then
				
				print("Candyman")
				
				messagingServive:PublishAsync("GlobalAnnouncement", "Server shutting down in 10 minutes. [Bug Fixes]")
				
			end
				
		end)
		
	end
	
end)

Also I’m not sure how I’m supposed to loop it through all players. Another thing is I don’t want to remove the PlayerAdded or there is going to be no way for me to be able to call on the player.

Nvm I fixed it by editing my script