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

How do I make a system message that shows locally to a player (I.E "Hey Stea_my! You're an admin!")?

I think this is just a newbie mistake but I'd like to make a message in the chat that only shows up for admins in their gui. It shows up for everyone and this is no desirable. This is probably a super newbie mistake but I haven't done this type of thing before, heres my code.

local eventyboys = game.ReplicatedStorage.Events
local gooey = game.StarterGui

eventyboys.Yes.OnClientEvent:connect(function(plr)
	gooey:SetCore("ChatMakeSystemMessage", {
		Text = "Hello, "..plr.Name.."! You are an Admin! Type ;cmds for commands.";
		Color = Color3.fromRGB(0, 16, 176);
		Font = Enum.Font.SourceSansBold;
		FontSize = Enum.FontSize.Size96;
		})
end)

eventyboys.AskedForCmds.OnClientEvent:connect(function(plr)
		gooey:SetCore("ChatMakeSystemMessage", {
		Text = "Admin Commands List";
		Color = Color3.fromRGB(255, 0, 0);
		Font = Enum.Font.SourceSansBold;
		FontSize = Enum.FontSize.Size96;
	})
	gooey:SetCore("ChatMakeSystemMessage", {
		Text = "---------------------";
		Color = Color3.fromRGB(0, 16, 176);
		Font = Enum.Font.SourceSansBold;
		FontSize = Enum.FontSize.Size96;
	})
		gooey:SetCore("ChatMakeSystemMessage", {
		Text = ";cmds";
		Color = Color3.fromRGB(255, 0, 0);
		Font = Enum.Font.SourceSansBold;
		FontSize = Enum.FontSize.Size96;
		})
				gooey:SetCore("ChatMakeSystemMessage", {
		Text = ";ff";
		Color = Color3.fromRGB(255, 0, 0);
		Font = Enum.Font.SourceSansBold;
		FontSize = Enum.FontSize.Size96;
				})
						gooey:SetCore("ChatMakeSystemMessage", {
		Text = ";rage";
		Color = Color3.fromRGB(255, 0, 0);
		Font = Enum.Font.SourceSansBold;
		FontSize = Enum.FontSize.Size96;
						})
								gooey:SetCore("ChatMakeSystemMessage", {
		Text = ";dust";
		Color = Color3.fromRGB(255, 0, 0);
		Font = Enum.Font.SourceSansBold;
		FontSize = Enum.FontSize.Size96;
								})
																gooey:SetCore("ChatMakeSystemMessage", {
		Text = ";lit";
		Color = Color3.fromRGB(255, 0, 0);
		Font = Enum.Font.SourceSansBold;
		FontSize = Enum.FontSize.Size96;
																})
gooey:SetCore("ChatMakeSystemMessage", {
		Text = ";nukeevent";
		Color = Color3.fromRGB(255, 0, 0);
		Font = Enum.Font.SourceSansBold;
		FontSize = Enum.FontSize.Size96;
})
gooey:SetCore("ChatMakeSystemMessage", {
		Text = ";kick";
		Color = Color3.fromRGB(255, 0, 0);
		Font = Enum.Font.SourceSansBold;
		FontSize = Enum.FontSize.Size96;
})
gooey:SetCore("ChatMakeSystemMessage", {
		Text = ";burntheashes";
		Color = Color3.fromRGB(255, 0, 0);
		Font = Enum.Font.SourceSansBold;
		FontSize = Enum.FontSize.Size96;
})
gooey:SetCore("ChatMakeSystemMessage", {
		Text = "---------------------";
		Color = Color3.fromRGB(0, 16, 176);
		Font = Enum.Font.SourceSansBold;
		FontSize = Enum.FontSize.Size96;
	})																

end)

Heres also the way the Events fire, that might be the problem aswell.

game:GetService("Players").PlayerAdded:Connect(function(plr)
    for _,v in pairs(ADMANS) do
        if (v == plr.UserId) then
            eventyboys.Yes:FireClient(plr)
            plr.Chatted:Connect(function(msg)
                if (string.sub(msg,0,1) == ";") then
                    local args = Split(msg)
                    if (Commands[args[1]] ~= nil) then
                        Commands[args[1]](args,plr)
                    end
                end
            end)    
        end
    end
end)

20 comments

0

why not just doing playeradded/characteradded event and then showing the message

0

because the event has to check in another script, this is in starterplayerscripts. again, im a newbie at this type of scripting.

0

Use game.Players.LocalPlayer instead of "plr". As .OnClientEvent on line 4 doesn't return the player.

0

Can you show me what you mean, Denny?

0

On line 6, replace "plr.Name" with "game.Players.LocalPlayer.Name".

0

OHH you misunderstood me, I'm sorry, the script saying "Hello Stea_my!" works, its just showing for everybody and not the player who is admin, if you have any fixes for it please explain, thank you!

0

Oh, sorry about that. How are you firing the events? Are you using :FireAllClients()?

0

Yes I am.

0

I have a list of admins that when I want to give them commands it fires an event called "Yes" using :FireAllClients().

0

Well, it should be easy to figure out then. It's firing to ALL the clients/players, so everyone sees the message. Instead, do :FireClient(plr) to fire it to a specific player. "plr" has to be the player object, and note you don't get the player still on .OnClientEvent.

0

I will try this, thank you!

0

No problem. Also, if the list are names, you can do something like game.Players:FindFirstChild(playernamehere) to get the player object.

0

It seems to work for another client event I'm doing but on the join event when I fire the client event it doesn't do anything.

0

I have added the way the on joined event fires for "Yes", if you can tell me what went wrong that'd be great!

0

Hmm...okay. Are you using UserIds in the "ADMANS" list or names? Your script only works for UserIds. Also, which client event isn't working? I tested out your script and it seems to work for me, but I couldn't test the chatted event part.

0

"ADMANS" is a UserId table, and the client event that is broken is "Yes", "AskedForCmds" works.

0

Strange. The "Yes" event works for me. On the local script, did you replace "plr.Name" with "game.Players.LocalPlayer.Name"?

0

No, I didn't.

0

There is an error in the script that says "Failed to index local plr (a nil value)"

0

I did what you said with using localplayer, it worked! I believe my script is fully functional, thank you, I will test it with other players later.

1 answer

You used StarterGui rather than PlayerGui. try this instead!

local eventyboys = game.ReplicatedStorage.Events
local plr = game.Players.LocalPlayer
local gooey = plr.PlayerGui

eventyboys.Yes.OnClientEvent:connect(function(plr)
    gooey:SetCore("ChatMakeSystemMessage", {
        Text = "Hello, "..plr.Name.."! You are an Admin! Type ;cmds for commands.";
        Color = Color3.fromRGB(0, 16, 176);
        Font = Enum.Font.SourceSansBold;
        FontSize = Enum.FontSize.Size96;
        })
end)

eventyboys.AskedForCmds.OnClientEvent:connect(function(plr)
        gooey:SetCore("ChatMakeSystemMessage", {
        Text = "Admin Commands List";
        Color = Color3.fromRGB(255, 0, 0);
        Font = Enum.Font.SourceSansBold;
        FontSize = Enum.FontSize.Size96;
    })
    gooey:SetCore("ChatMakeSystemMessage", {
        Text = "---------------------";
        Color = Color3.fromRGB(0, 16, 176);
        Font = Enum.Font.SourceSansBold;
        FontSize = Enum.FontSize.Size96;
    })
        gooey:SetCore("ChatMakeSystemMessage", {
        Text = ";cmds";
        Color = Color3.fromRGB(255, 0, 0);
        Font = Enum.Font.SourceSansBold;
        FontSize = Enum.FontSize.Size96;
        })
                gooey:SetCore("ChatMakeSystemMessage", {
        Text = ";ff";
        Color = Color3.fromRGB(255, 0, 0);
        Font = Enum.Font.SourceSansBold;
        FontSize = Enum.FontSize.Size96;
                })
                        gooey:SetCore("ChatMakeSystemMessage", {
        Text = ";rage";
        Color = Color3.fromRGB(255, 0, 0);
        Font = Enum.Font.SourceSansBold;
        FontSize = Enum.FontSize.Size96;
                        })
                                gooey:SetCore("ChatMakeSystemMessage", {
        Text = ";dust";
        Color = Color3.fromRGB(255, 0, 0);
        Font = Enum.Font.SourceSansBold;
        FontSize = Enum.FontSize.Size96;
                                })
                                                                gooey:SetCore("ChatMakeSystemMessage", {
        Text = ";lit";
        Color = Color3.fromRGB(255, 0, 0);
        Font = Enum.Font.SourceSansBold;
        FontSize = Enum.FontSize.Size96;
                                                                })
gooey:SetCore("ChatMakeSystemMessage", {
        Text = ";nukeevent";
        Color = Color3.fromRGB(255, 0, 0);
        Font = Enum.Font.SourceSansBold;
        FontSize = Enum.FontSize.Size96;
})
gooey:SetCore("ChatMakeSystemMessage", {
        Text = ";kick";
        Color = Color3.fromRGB(255, 0, 0);
        Font = Enum.Font.SourceSansBold;
        FontSize = Enum.FontSize.Size96;
})
gooey:SetCore("ChatMakeSystemMessage", {
        Text = ";burntheashes";
        Color = Color3.fromRGB(255, 0, 0);
        Font = Enum.Font.SourceSansBold;
        FontSize = Enum.FontSize.Size96;
})
gooey:SetCore("ChatMakeSystemMessage", {
        Text = "---------------------";
        Color = Color3.fromRGB(0, 16, 176);
        Font = Enum.Font.SourceSansBold;
        FontSize = Enum.FontSize.Size96;
    })                                                              

end)

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