So while I was working on my broadcast MainModule script, suddenly, the PlayerAdded event on the Players service stopped functioning correctly. . Here is the code: .
local module = {} function module.broad() local players = game.Players:GetChildren() for num = 1,#players do script.MessageGui:Clone().Parent = players[num].PlayerGui end script.MessageGui:Clone().Parent = game.StarterGui local events = script:GetChildren() for num = 1,#events do if events[num]:IsA("RemoteEvent") then events[num]:Clone().Parent = game.ReplicatedStorage end end local eventMain = game.ReplicatedStorage:WaitForChild("MsgiSen") local eventHelp = game.ReplicatedStorage:WaitForChild("MsgiHelp") local eventNum = game.ReplicatedStorage:WaitForChild("MsgiSenNum") local eventDiep = game.ReplicatedStorage:WaitForChild("MsgiSenDiep") local eventDevx = game.ReplicatedStorage:WaitForChild("MsgiSenDevx") local eventSP00K = game.ReplicatedStorage:WaitForChild("MsgiSenSP00K") --Assign Permit function to make it easier to allow players permission. local function AssignPermit(UserId, EventInstance, PlrRequired) local PlayerFromId = game:GetService("Players"):GetPlayerByUserId(UserId) if PlrRequired ~= nil then if PlayerFromId ~= PlrRequired then return end end pcall(function() PlayerFromId.Chatted:Connect(function(msg) if string.sub(msg,1,3) == "/b " then -- Makes it so that only when this command runs should the event fire. print(PlayerFromId.Name .. " sent a broadcast to all existing clients on the server.") EventInstance:FireAllClients(msg) -- Sends a message. elseif msg == "/bhelp" then eventHelp:FireClient(PlayerFromId) elseif string.sub(msg,1,4) == "/db " then print(PlayerFromId.Name .. " sent a broadcast to all existing clients on the server. (Diep.io)") eventDiep:FireAllClients(msg) end end) end) end -- Allowed players (sorted from highest to lowest priority) AssignPermit(199610885, eventMain) -- IxGamerXL game:GetService("Players").PlayerAdded:Connect(function(plr) AssignPermit(199610885, eventMain, plr) -- IxGamerXL end) end return module
. (I removed the other players that were allowed on my module to protect their usernames and UserIds.) . Last time I tried require() on it, it did grant the GUI and permission, but once I rejoin the same server, it doesn't fire the PlayerAdded event, or it doesn't work correctly. Can someone help me on this? . Here is the link to the MainModule, so you can edit it to add your own UserId to the permit list, thus allowing you to publish it so you can require() it with it's Asset ID. I am going to remove this link the time this issue has been answered: https://www.roblox.com/library/6230551250/