How would I make a notification handler with FireServer?

I already have a ban command and I want the GUi to come up when they get banned.

You’d want FireClient for this, and you’d want your own client to be fired (not a random local client).

Can you send the script? If you can send the script I can help you modify it. You would use FireClient to do this.

I want the whole server to see it.

Yes I will.

local DataStore = game:GetService("DataStoreService")

return function (context, player, reason)
	local CoreDS = DataStore:GetDataStore(context.Executor.UserId.."Core")
		player:Kick("\nModerator: "..context.Executor.Name.."\nReason: "..reason)
	    game.ReplicatedStorage.Remotes.Notification:FireAllClients(player.Name.." has been kicked by ".. context.Executor.Name.."for "..reason..".","Moderation!")
	
	local url = ""
		local http = game:GetService("HttpService")

		local data = {
			embeds = {
				{
					author = {name = context.Executor.Name},
					title = "Kicked "..player.Name,
					type = "rich",
					description = '"'..reason..'"',
				}
			}
		}

		local newdata = http:JSONEncode(data)
		http:PostAsync(url,newdata)

		return ("Command executed.")
end

Okay, do you have a LocalScript in the GUI that shows the ban?

1 Like

No, I don’t but I could make one if you want.

Okay, could you quickly send a screenshot of the GUI that is supposed to pop up and the items in it? Then I’ll know what script you need.

image
The Local script is for leaving and joining the game, which has nothing to do with the notification one.

Okay perfect. You want the whole frame to become visible for everyone when someone gets banned, or just the Notification image?

Whole frame to become visible for everyone when someone gets banned.

Okay, insert a LocalScript in the frame that says this:

game.ReplicatedStorage.Remotes.Notification.OnClientEvent:Connect(function(reason)
   script.Parent.Visible = true
end)

Also, should the ModerationMessage TextLabel state who got banned and why?

Yes, it should do that would be nice.

Okay, just change that LocalScript just a bit. It should say this:

game.ReplicatedStorage.Remotes.Notification.OnClientEvent:Connect(function(reason)
   script.Parent.Visible = true
   script.Parent.Notification.ModerationMessage.Text = reason
end)

Let me know if that works
(And that should be a LocalScript inside of the Frame)

If you want the Frame to disappear after a few seconds, just change it to this:

game.ReplicatedStorage.Remotes.Notification.OnClientEvent:Connect(function(reason)
   script.Parent.Visible = true
   script.Parent.Notification.ModerationMessage.Text = reason
   wait(3)
   script.Parent.Visible = false
end)

Then you need FireAllClients() instead of FireClient(), FireServer() isn’t needed here.

They have a FireAllClients already.

Nothing comes up when I kick the person.

image
I believe I have put it in the right place

Okay, I misunderstood you. Try this in the LocalScript now:

game.ReplicatedStorage.Remotes.Notification.OnClientEvent:Connect(function(reason)
   script.Parent.Parent.Visible = true
   script.Parent.ModerationMessage.Text = reason
   wait(3)
   script.Parent.Parent.Visible = false
end)

I have put it into the correct place?