Help converting a local script to server

Hello! I’m a bit stuck on how to even convert this local script into a server script, I want the system notifications in the chat to be visible to everyone in the game.

Location:
image
(OofHandler)

Script:

local player = game.Players.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

bc = BrickColor.new(255,0,0)


humanoid.Died:Connect(function()

	print("{SYSTEM}: "..game.Players.LocalPlayer.Name.." has been banned.")
	
	game.StarterGui:SetCore("ChatMakeSystemMessage", {
		Text = "{SYSTEM}: "..game.Players.LocalPlayer.Name.." has been banned."; 
		--Font = Enum.Font.SourceSans;
		Color = bc.Color;
		FontSize = Enum.FontSize.Size60;
	})
		
end)

You can use the :FireServer() function from a remote event

1 Like

does not work in a script
make it localscript
or Connect it to game.Players.PlayerAdded

1 Like

It’s already local, but I don’t know how to like convert it so its server sided, making these notifications visible to all players.

do

-- script

bc = BrickColor.new(255,0,0)
game.Players.PlayerAdded:Connect(function(player)--every player that joins is registered
    local character = player.Character or player.CharacterAdded:Wait()
    local humanoid = character:WaitForChild("Humanoid")
    humanoid .Died:Connect(function()
        game.ReplicatedStorage.RemoteEvent:FireAllClients(player) -- since we cant use setCore on a server script i use a RemoteEvent
    end)
end)
--local script
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(OtherPlayer)
    game.StarterGui:SetCore("ChatMakeSystemMessage", {
		Text = "{SYSTEM}: "..OtherPlayer.Name.." has been banned."; 
		--Font = Enum.Font.SourceSans;
		Color = bc.Color;
		FontSize = Enum.FontSize.Size60;
	})
end)
2 Likes

It’s working, let me check if its server sided!

Okay, it’s working - THANK YOU!