Script 1 ServerScript Service
local GroupId = 9852197 local MiniumRankIdForJoinMessage = 255
game.Players.PlayerAdded:Connect(function(Player) if Player:GetRankInGroup(GroupId) >= MiniumRankIdForJoinMessage then game.ReplicatedStorage.PlayerJoinEvent:FireAllClients(Player.Name, Player.UserId) end end)
Script 2 StarterGui
local StarterGUI = game:GetService("StarterGui")
local function SendNotification(Title, Text, Icon) StarterGUI:SetCore("SendNotification", { Title = Title, Text = Text, Icon = Icon }) end
game.ReplicatedStorage.PlayerJoinEvent.OnClientEvent:Connect(function(Playername, PlayerUserId) SendNotification("Join Message", Playername .. "has joined game!", game.players:GetUserThumbnailAsync(PlayerUserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420))
--RealKrautic has joined the game!
end)
Server Script If your script is a Server script then you can only FireClient(the client here) or FireAllClients() to fire to all players and you you receive OnServerEvent()
Local Script you fireServer() and receive OnClientEvent()
The other answer has a few errors, so im going to fix them
If you fire server, you will recieve OnServerEvent(). You only fire server in a local script and you want to contact with a server script to make a currency change or something like that.
If you fire client, you have to fire the player as well, and the player can be gotten in a bunch of different ways, such as when the player joins, the first parameter of player added is the player. So:
FireClient(playerhere)
then on the client, you would type OnClientEvent()
You can also do FireAllClients, which will fire the event so that all OnClientEvents will run, which is useful if you are making things like guis that will show to everybody.
I hope this has helped you, if so, please accept this answer :)