Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Server welcome message doesn't work, why?

Asked by 5 years ago
Edited 5 years ago
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.

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. ScrewDeath 153 — 5y
0
Startergui why that? U can’t edit it u need to go to player.PlayerGui MaxDev_BE 55 — 5y
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. superalp1111 662 — 5y
0
Berries can you put your code in a codeblock? It's hard to read. superalp1111 662 — 5y
View all comments (2 more)
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. ScrewDeath 153 — 5y
0
Sorry, now you can read the script. Ber_ries 18 — 5y

1 answer

Log in to vote
0
Answered by
poke7667 142
5 years ago

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.

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? ScrewDeath 153 — 5y
0
Oh, my bad. localscripts can run in workspace, so you can put it there or in StarterPlayerScripts / StarterCharacterScripts poke7667 142 — 5y
Ad

Answer this question