Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a notification that tells you if a HR has joined from a group with a SCP Logo Image?

So recently, I found myself in the SCP Genre, and I want to ask how Eltorks SCP:F has made it so it gives a server-wide notification if a HR has joined: etc. (RANK) (Name) has joined.

All help is appreciated.

1 comment

0

PlayerAdded and :IsInGroup() can get you started. See wiki. Make an attempt at code for real help.

1 answer

✓ Accepted answer

You can use the PlayerAdded Event to check that a player has joined the game, then use their role [string] (:GetRoleInGroup()) or rank [0 to 255] (:GetRankInGroup()) to check if a message should be created.

game:GetService("Players").PlayerAdded:Connect(function(player)
    local groupid = 0
    local role = player:GetRoleInGroup(groupid)
    local rank = player:GetRankInGroup(groupid)
end)

You will require a RemoteEvent since the StarterGui:SetCore() can only be processed by the Client

local remote = Instance.new("RemoteEvent")
remote.Name = "HRJoinEvent"
remote.Parent = game:GetService("ReplicatedStorage")

Using FireAllClients() can be used to allow the message to be created for all players in the server.

remote:FireAllClients(player.Name, role)

Once sent to the Client, the :ChatMakeSystemMessage() Core can be used to create an in-game message.

game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", {Text = ("["..role.."] "..name.." has joined.")})

Below, I'm going to use the Rank number to determine when the message is sent since it will encompass more roles than choosing each string with or logic operators

Server Script under ServerScriptService

local remote = Instance.new("RemoteEvent")
remote.Name = "HRJoinEvent"
remote.Parent = game:GetService("ReplicatedStorage")

game:GetService("Players").PlayerAdded:Connect(function(player)
    local groupid = 0
    local role = player:GetRoleInGroup(groupid)
    local rank = player:GetRankInGroup(groupid)
    if rank > 200 then
	    remote:FireAllClients(player.Name, role)
    end
end)

Local Script under StarterGui

local remote = game:GetService("ReplicatedStorage"):WaitForChild("HRJoinEvent")

remote.OnClientEvent:Connect(function(name, role)
    game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", {Text = ("["..role.."] "..name.." has joined.")})
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.