Hello! My is Kamikaze. Ok so I thought is was a good idea to put a server message when players join. I didn’t know how to do myself, so I found @Alvin_Blox’s tutorial from 2017. I tried it, but didn’t seem to work. (Probably because it is outdated). I know also, that I need to PlayerAdded. Thanks! (The script:)
'''
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = "{System} Welcome to Sprint Course!";
Font = Enum.Font.Cartoon;
Color = Color3.new(253, 251, 255);
FontSize = Enum.FontSize.Size96
})
'''
Also I want it so that it will display the joining players name. Ex: Welcome, (Players name)!
Alright, you’ll want that in a local script, StarterGui:SetCore() can’t be called on server.
If you want the server to delegate when a system message is made then you can use a remote event.
But since you’re not concatenating a player’s name with the system message, you probably don’t want the welcome to fire for every player added. So just try it as it is above in a local script.
local scripts in starter player scripts get cloned to each player when they join, so it’s like there’s a built in PlayerAdded function. Make it a local script and put it in starter player scripts, see if it works. You can’t use SetCore in a server script, which is why it wasn’t working. Your script looks good, don’t put it in a player added function or anything.
There’s no point in using a remote event for this. You can just put the local script in somewhere like starter player scripts and it will run right when the player joins anyway.
Hey, I tried your code and it seemed to work perfectly fine for me.
Make sure that the code is as high as it can be in the script and not under any statements that may yield further instructions (example: if you have a while true do statement above this code then it wouldn’t work.
Finally, make sure your code is in a locally replicated area. The most common being StarterGui and StarterPlayerScripts.
If you’re still having issues I’ve re-formatted the code along with sent a place file containing just the code.
Code
local StarterGui = game:GetService("StarterGui");
StarterGui:SetCore("ChatMakeSystemMessage", {
Text = "{System} Welcome to Sprint Course!";
Font = Enum.Font.Cartoon;
Color = Color3.new(253, 251, 255);
FontSize = Enum.FontSize.Size96
})
How would you randomize the text? (By using math.random?) Because through the game, I want text that is selected randomly to pop up? Also, how do you insert the players name into the text? ex “Hello! (PlayersName)!”
You can make a while loop that constantly sends that text.
local waitingtime = 100
while true do
local StarterGui = game:GetService("StarterGui");
StarterGui:SetCore("ChatMakeSystemMessage", {
Text = "{System} Welcome to Sprint Course!";
Font = Enum.Font.Cartoon;
Color = Color3.new(253, 251, 255);
FontSize = Enum.FontSize.Size96
})
wait(waitingtime)
end
(Sorry for the bad indenting, I’m on mobile)
If you want it to choose a random waiting time between messages, you can use math.random.
local waitingtime = math.random(LowestPossibleNumber, HighestPossibleNumber)
You can insert the player’s name by getting the local player and checking it’s name property.
local player = game.Players.LocalPlayer
-- later on
local Text = "Hello "..player.Name.."!"