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

Server welcome message doesn't work, why?

local Players = game:GetService("Players")
 
function onPlayerAdded(player)
	game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
	Text = ("[SERVER]: ".. player.Name .. " has entered the game.");
	Color = Color3.new(255,255,255);
	Font = Enum.Font.SourceSansBold; 
	FontSize = Enum.FontSize.Size18;
})
end
 
Players.PlayerAdded:connect(onPlayerAdded)
 
for _,player in pairs(Players:GetPlayers()) do
     onPlayerAdded(player)
end

(This script is in StarterGUI).

Also, it's a regular script which located in StarterGUI.

6 comments

0

If it's in StarterGui, I'm guessing it's a localscript. Wouldn't even work if it was a normal script. You can only use PlayerAdded using normal scripts and StarterGUI isn't a place for one to be at. Also, anything modified to the StarterGui will not be seen by players. Their Gui's are clones of the StarterGui, but other than that, they are not connected.

0

Startergui why that? U can’t edit it u need to go to player.PlayerGui

1

Guys, SetCore is a StarterGui function which lets you do several things like creating a system message. Stop telling he can't change StarterGui he is not trying to.

0

Berries can you put your code in a codeblock? It's hard to read.

0

Oops, didn't know that was a thing. Sorry for missing that! Anyways, I still believe it's not working because PlayerAdded isn't something you use in a localscript.

0

Sorry, now you can read the script.

1 answer

✓ Accepted answer

If you want the welcome message to show to everyone, you have to put this script on the server side.

game.Players.PlayerAdded:Connect(function(plr) -- Checks when a player joins.
	game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{ 
		Text = ("[SERVER]: ".. plr.Name .. " has entered the game."); 
		Color = Color3.new(255,255,255); 
		Font =  Enum.FontSize.Size18;
	})
end)

Otherwise, put this in a localscript in workspace.

2 comments

0

Not sure if this will work since (according to http://wiki.roblox.com/index.php?title=API:Class/StarterGui/SetCore) SetCore only works with client. Also, why would you put a localscript in workspace?

0

Oh, my bad. localscripts can run in workspace, so you can put it there or in StarterPlayerScripts / StarterCharacterScripts

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