Hello Devs,
I have this module script and a normal script and it doesn’t run.
Could you have any suggestions.
module script
local module = {}
function module.PartCount()
local m = game.workspace.Model
local pa = m:GetChildren()
for i, pa in ipairs(pa) do
print(i)
end
end
return module
normal script
wait(16)
game.Players.PlayerAdded:Connect(function(plr)
local WOWO = require(plr.AdministratorPanel.Scripts:WaitForChild("Modules").Home)
WOWO.PartCount()
end)
By the time you connect the function to the PlayerAdded event, it has already fired. You can call the function on already joined players:
task.wait(16)
local function PlayerAdded(plr)
--your code
end
for _, plr in ipairs(game.Players:GetChildren()) do
PlayerAdded(plr)
end
game.Players.PlayerAdded:Connect(PlayerAdded)