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

I have a join and leave script, but it wont work what happened?

Asked by 5 years ago
Edited 5 years ago

---Important Things---

So I have a join and leave script with 4 important things. The first thing is a Remote Event named Added. The second thing is a Remote Event named Removing. The third thing is a script named Added/Removing. The fourth and final thing is a script name Message. The Join and the Message should show up in the chat.

---Locations---

-The Added Event is in Replicated Storage. -The Removing Event is in the Replicated Storage. -The Added/Removing Script is in the Workspace. -The Message Script is in the StarterGui.

---Problem--- Players.vincentthecat1.PlayerGui.Message:9: '}' expected (to close '{' at line 5) near 'FontSize'

---Added/Removing Script---

1local events = game.ReplicatedStorage.Events
2 
3game.Players.PlayerAdded:connect(function(plr)
4    events.Added:FireAllClients(plr)
5end)
6---
7game.Players.PlayerAdded:connect(function(plr)
8    events.Removing:FireAllClients(plr)
9end)

---Message Script---

01local events = game.ReplicatedStorage.Events
02local starterGui = game.StarterGui
03 
04events.Added.OnClientEvent:connect(function(plr)
05    starterGui:SetCore("ChatMakeSystemMessage",{
06        Text = plr.Name.." has joined the game!";
07        Color = Color3.fromRGB(0,255,255);
08        Font = Enum.Font.SourceSansBold
09        FontSize = Enum.FontSize.Size32;
10        })
11end)
12---
13events.Removing.OnClientEvent:connect(function(plr)
14    starterGui:SetCore("ChatMakeSystemMessage",{
15        Text = plr.Name.." has left the game!";
16        Color = Color3.fromRGB(0,255,255);
17        Font = Enum.Font.SourceSansBold
18        FontSize = Enum.FontSize.Size32;
19        })
20end)

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Looks like the only problem is you're missing a semi-colon (or comma) after Font = Enum.Font.SourceSansBold, Lines 8 and 17. This should have underlined in red for you, but whatever.

P.S. :connect() is deprecated (PlayerAdded:connect(plr)), use :Connect() instead.

Ad
Log in to vote
0
Answered by
SCP774 191
5 years ago

Your script looks fine, the reason is most likely that your script is too big. It takes a long time to load, so long that the player loads faster than the server. In that way, the PlayerAdded event won't fire.

Answer this question