How to send message through server

I was wondering how to make a server send a message in chat. Hears my current code:

local:

game.StarterGui:SetCore( "ChatMakeSystemMessage",  { Text = player.Name.. "  got "..(accuracy*100).." Accuracy on Songname", Color = Color3.fromRGB( 255,0,0 ), Font = Enum.Font.Arial, FontSize = Enum.FontSize.Size24 } )
		
game.ReplicatedStorage.Remote_Events.SendMessage:FireServer(accuracy)

server:

game.ReplicatedStorage.Remote_Events.SendMessage.OnServerEvent:Connect(function(player, accuracyThing)

	local TextService = game:GetService("TextService")
	local filteredTextResult = TextService:FilterStringAsync("Test Message","Server")

end)

The output results in “Unable to cast string to int64” on the server

don’t mind the messages that I wrote in the parameter.

https://developer.roblox.com/en-us/api-reference/function/TextService/FilterStringAsync

I think you’re trying to reference a string Type, instead of a Int64 type

The second parameter should be the Player’s UserID

What would I do if it is being sent as a [Server] message?

I’m pretty sure you can just reference your Text variable as this inside your LocalScript:

game.StarterGui:SetCore( "ChatMakeSystemMessage",  { Text = "[Server] "..player.Name.. "  got "..(accuracy*100).." Accuracy on Songname", Color = Color3.fromRGB( 255,0,0 ), Font = Enum.Font.Arial, FontSize = Enum.FontSize.Size24 } )

game.ReplicatedStorage.Remote_Events.SendMessage:FireServer(accuracy)

You could also use ChatService’s SetExtraTags if you wanted, but either way can work fine I believe

ok but Im having trouble with the player parameter since it is a server sending script reporting peoples scores

Again:

image

The second parameter of FilterStringAsync is the Player’s UserID, so you could just reference your server script like this:

game.ReplicatedStorage.Remote_Events.SendMessage.OnServerEvent:Connect(function(player, accuracyThing)
	local TextService = game:GetService("TextService")
	local filteredTextResult = TextService:FilterStringAsync("Test Message", player.UserId)
end)

So no errors were established however, it only sent to one person, not everyone in the server

Wait, are you wanting to send it to the entire server? I believe the thing here, is that ChatMakeSystemMessage is used on the client so only the person who completed the song can see it

Maybe what you could do, is create a BoolValue which would detect when a player has finished a specific song, then after changing it, will call FireAllClients() from your RemoteEvent to use from the server, onto every client so that way it will properly make it visible to all players? I’m unsure though what your accuracy variable is, so you’d need to send that on the server instead of the client

I did that however it still does the same thing(sends to one person)
client:
‘’’
game.ReplicatedStorage.Remote_Events.FinishedSong:FireServer(accuracy)

	game.ReplicatedStorage.Remote_Events.SendMessage.OnClientEvent:Connect(function(player, accuracyVal)
		game.StarterGui:SetCore( "ChatMakeSystemMessage",  { Text = player.Name.. "  got "..(accuracyVal*100).." Accuracy on Songname", Color = Color3.fromRGB( 255,0,0 ), Font = Enum.Font.Arial, FontSize = Enum.FontSize.Size24 } )
	end)

‘’’

server:
‘’’
game.ReplicatedStorage.Remote_Events.FinishedSong.OnServerEvent:Connect(function(player, accuracyThing)
game.ReplicatedStorage.Remote_Events.SendMessage:FireAllClients(player, accuracyThing)

end)
‘’’