Hey everyone! Hope your are doing well, so today I was scripting a little thing, didn’t realize I would have this much trouble with it but basically, when a player joins, a message should appear saying that player joined with their name and when they leave it says the same thing except it says player left. For some odd reason, my scripts are not working. I’m sure it is a little minor mistake but here are both of my scripts…
This one is in SSS
local Rep = game:GetService("ReplicatedStorage")
local Added = Rep:WaitForChild("Added")
local Removing = Rep:WaitForChild("Removing")
game.Players.PlayerAdded:Connect(function(plr)
Added:FireClient(plr, plr.Name)
end)
game.Players.PlayerRemoving:Connect(function(plr)
Removing:FireClient(plr, plr.Name)
end)
Basically that one is just the script that controls the events to be used.
The next script is in StarterGui, this script just handles all the information for the events…
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Added = ReplicatedStorage:WaitForChild("Added")
local Removing = ReplicatedStorage:WaitForChild("Removing")
local startergui = game.StarterGui
Added.OnClientEvent:Connect(function(plr)
print("Fired!")
startergui:SetCore("ChatMakeSystemMessage",{
text = "[SYSTEM]"..plr.Name.." has joined the game!";
Color3.fromRGB(0, 255, 0);
Font = Enum.Font.GothamBold;
FontSize = Enum.FontSize.Size32;
})
end)
Removing.OnClientEvent:Connect(function(plr)
print("Fired other!")
startergui:SetCore("ChatMakeSystemMessage",{
text = "[SYSTEM]"..plr.Name.." has left the game!";
Color3.fromRGB(170, 0, 0);
Font = Enum.Font.GothamBold;
FontSize = Enum.FontSize.Size32;
})
end)
Those are both of my scripts, if anyone knows how to fix this(Because I am really new with using “ChatMakeSysttemMessage”) Please let me know! Thanks ahead of time :))
lol, idk how I mixed that up, but it didn’t work, I think the reason why is because I’m getting an infinite yield… Infinite yield possible on ‘ReplicatedStorage:WaitForChild(“Added”)’
That means it can’t find any object named “Added” in ReplicatedStorage. Make sure your remote events are a direct child of ReplicatedStorage and are named “Added” and “Removing” (caps sensitive).
If this is already the case, can you screenshot your explorer view and send it here?