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
why not just doing playeradded/characteradded event and then showing the message
because the event has to check in another script, this is in starterplayerscripts. again, im a newbie at this type of scripting.
Use game.Players.LocalPlayer instead of "plr". As .OnClientEvent on line 4 doesn't return the player.
Can you show me what you mean, Denny?
On line 6, replace "plr.Name" with "game.Players.LocalPlayer.Name".
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!
Oh, sorry about that. How are you firing the events? Are you using :FireAllClients()?
Yes I am.
I have a list of admins that when I want to give them commands it fires an event called "Yes" using :FireAllClients().
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.
I will try this, thank you!
No problem. Also, if the list are names, you can do something like game.Players:FindFirstChild(playernamehere) to get the player object.
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.
I have added the way the on joined event fires for "Yes", if you can tell me what went wrong that'd be great!
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.
"ADMANS" is a UserId table, and the client event that is broken is "Yes", "AskedForCmds" works.
Strange. The "Yes" event works for me. On the local script, did you replace "plr.Name" with "game.Players.LocalPlayer.Name"?
No, I didn't.
There is an error in the script that says "Failed to index local plr (a nil value)"
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.