I'm trying to make a server chat message for the client, but somehow when I pass a player argument for :FireClient(), it went missing when it reaches the message script.
This is the :FireClient() message (server script):
local MessageEvent = game:GetService("ReplicatedStorage").EventsFolder.ServerMessageEvent local Player = game.Players:GetPlayerFromCharacter(hit.Parent) local text = "You have been given "..Points.Value.. " Points for completing the map with the score of " ..Score.Value MessageEvent:FireClient(Player,text)
And this is the local script that's supposed to fire:
MessageEvent = game:GetService("ReplicatedStorage").EventsFolder.ServerMessageEvent MessageEvent.OnClientEvent:Connect(function(Player,text) print(text) print(Player) game.StarterGui:SetCore("ChatMakeSystemMessage",{ Text = ("[Server]:"..text); Font = Enum.Font.SourceSansBold; Color = Color3.new(237, 255, 114); FontSize = Enum.FontSize.Size18}) end)
And this is what it prints out: (the first 2 lines are from FireAllClients,which sends the server message to the whole server.) (server chat messages are client-sided,which is why i'm doing this)
asgm has beaten The First Map with the score of 11! asgm nil You have been given 6 Points for completing the map with the score of 11 08:23:43.633 - Players.asgm.PlayerGui.ServerMessage:17: attempt to concatenate local 'text' (a nil value)
as you can see, print(Player) prints out the text instead of "asgm" while (text) goes missing. When I remove the "Player" argument, it prints out this:
asgm has beaten The First Map with the score of 11! asgm 08:16:20.382 - Unable to cast value to Object
Is there something I'm missing? (forgive me if my use of the word "argument" is misleading i don't use it quite often since i often get confused with the term "argument" and "parameter")