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---

local events = game.ReplicatedStorage.Events

game.Players.PlayerAdded:connect(function(plr)
    events.Added:FireAllClients(plr)
end)
---
game.Players.PlayerAdded:connect(function(plr)
    events.Removing:FireAllClients(plr)
end)

---Message Script---

local events = game.ReplicatedStorage.Events
local starterGui = game.StarterGui

events.Added.OnClientEvent:connect(function(plr)
    starterGui:SetCore("ChatMakeSystemMessage",{
        Text = plr.Name.." has joined the game!";
        Color = Color3.fromRGB(0,255,255);
        Font = Enum.Font.SourceSansBold
        FontSize = Enum.FontSize.Size32;
        })
end)
---
events.Removing.OnClientEvent:connect(function(plr)
    starterGui:SetCore("ChatMakeSystemMessage",{
        Text = plr.Name.." has left the game!";
        Color = Color3.fromRGB(0,255,255);
        Font = Enum.Font.SourceSansBold
        FontSize = Enum.FontSize.Size32;
        })
end)

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