Fun fact is, it prints print("local CheckForPlayersCoreScript = require(script.Modules.CheckForPlayersCoreScript)") (First line), then should run the Local Require line, but this seems to fail (i guess) as the second print command is not running.
Sad thing is, the debug console shows NO error⌠Help?
Edit:
The targeted Module Script is inside a folder, the folder is inside the script which should do the mentioned above lines.
local CheckForPlayersCoreScript = require(script:WaitForChild("Modules"):WaitForChild("CheckForPlayersCoreScript"))
CheckForPlayersCoreScript.CheckForPlayers()
All I can suggest is add âWaitForChild()â calls, you probably need to share the ModuleScript itself for more assistance.
The Module Script.
Not to mention iâm quite new to Moduleâs, so donât mind the messynes.
local ShowAnnouncementBox1Remote = workspace.Remotes:WaitForChild('ShowAnnouncementBox1')
local MinimumPlayers = script.Parent.Parent.Settings.MinimumPlayers.Value
local ChangeAnnouncement1Text = workspace.Remotes:WaitForChild('ChangeAnnouncement1Text')
local GetPlayersReadyCoreScript = require(script.Parent:WaitForChild('GetPlayersReadyCoreScript'))
local PickMapCoreScript = require(script.Parent:WaitForChild('PickMapCoreScript'))
local CheckForPlayersCoreScript = {}
CheckForPlayersCoreScript.CheckForPlayers = function()
warn('CheckForPlayersCoreScript.CheckForPlayers = function()')
ShowAnnouncementBox1Remote:FireAllClients()
if #workspace.InGamePlayers:GetChildren() <= MinimumPlayers then
repeat
ChangeAnnouncement1Text:FireAllClients("Waiting for players")
wait(4)
ChangeAnnouncement1Text:FireAllClients("(3+ players required)")
wait(2)
until #workspace.InGamePlayers:GetChildren() >= MinimumPlayers
elseif #workspace.InGamePlayers:GetChildren() >= MinimumPlayers then
end
GetPlayersReadyCoreScript.GetPlayersReady()
wait()
PickMapCoreScript.PickMap()
end
return CheckForPlayersCoreScript
The module scriptâs first function line, doesnât print either.
If youâre not getting any errors in console you can debug the function by using print() commands each line until a print seemingly fails to execute. That will indicate the point at which some exception is occurring.
So, iâve made a normal script, still in the Module Folder (as mentioned above)
This is how it looks now, take a look at the prints.
local ShowHideAFKButtonRem = game.ReplicatedStorage.ShowHideAFKButtonRemote
local ShowHideGamepassShopRem = game.Workspace.Remotes.ShowHideGamepassShopRemote
local ChangeAnnouncement1Text = workspace.Remotes:WaitForChild('ChangeAnnouncement1Text')
local CloseLoadingGui = workspace.Remotes:WaitForChild('CloseLoadingGui')
local OpenLoadingGui = workspace.Remotes:WaitForChild('OpenLoadingGui')
local GameSettingRemotes = game.ReplicatedStorage.GameSettingRemotes
local AnchorRem = GameSettingRemotes.AnchorRemote
local ChangeAmbientToClient = game.ReplicatedStorage.ChangeAmbientRemoteToClient
local DisableSeats = workspace.Remotes.DisableSeats
local StartCountDownCoreScript = require(script.Parent.StartCountDownCoreScript)
PNCPDebouunce = false
NewCurrentPlayer = nil
CurrentPlayer = nil
Found = false
function Run()
warn('RUNNING')
if PNCPDebouunce == true then return end
PNCPDebouunce = true
Found = false
repeat
NewCurrentPlayer = game.Workspace.PlayersInMatch:GetChildren()[math.random(1,#workspace.PlayersInMatch:GetChildren())]
CurrentPlayer = game.Players:WaitForChild(NewCurrentPlayer.Name)
print('NewCurrentPlayer = ',CurrentPlayer,'.')
Found = true
PNCPDebouunce = false
return CurrentPlayer
until Found == true
PNCPDebouunce = false
end
wait(15)
warn('Going to run')
Run()
Iâm not kidding, but the warnâs are not printingâŚ
Now, by removing âlocal StartCountDownCoreScript = require(script.Parent.StartCountDownCoreScript)â
It seems to run, finally with a errorâŚ
22:40:49.780 Going to run - Server - TestScript:33
22:40:49.780 RUNNING - Server - TestScript:17
22:40:49.780 ServerScriptService.MainScriptRewroteV4.Modules.TestScript:22: invalid argument #2 to 'random' (interval is empty) - Server - TestScript:22
22:40:49.780 Stack Begin - Studio
22:40:49.780 Script 'ServerScriptService.MainScriptRewroteV4.Modules.TestScript', Line 22 - function Run - Studio - TestScript:22
22:40:49.780 Script 'ServerScriptService.MainScriptRewroteV4.Modules.TestScript', Line 34 - Studio - TestScript:34
22:40:49.780 Stack End - Studio
^^^ This error usually happens when the second argument is lower than the first, or if there is no input.
Try this:
local ShowHideAFKButtonRem = game.ReplicatedStorage.ShowHideAFKButtonRemote
local ShowHideGamepassShopRem = game.Workspace.Remotes.ShowHideGamepassShopRemote
local ChangeAnnouncement1Text = workspace.Remotes:WaitForChild('ChangeAnnouncement1Text')
local CloseLoadingGui = workspace.Remotes:WaitForChild('CloseLoadingGui')
local OpenLoadingGui = workspace.Remotes:WaitForChild('OpenLoadingGui')
local GameSettingRemotes = game.ReplicatedStorage.GameSettingRemotes
local AnchorRem = GameSettingRemotes.AnchorRemote
local ChangeAmbientToClient = game.ReplicatedStorage.ChangeAmbientRemoteToClient
local DisableSeats = workspace.Remotes.DisableSeats
local StartCountDownCoreScript = require(script.Parent.StartCountDownCoreScript)
local PNCPDebouunce = false
local NewCurrentPlayer = nil
local CurrentPlayer = nil
local Found = false
function Run()
warn('RUNNING')
if PNCPDebouunce == true then return end
PNCPDebouunce = true
Found = false
if #workspace.PlayersInMatch:GetChildren() >= 1 then
repeat
NewCurrentPlayer = game.Workspace.PlayersInMatch:GetChildren()[math.random(1,#workspace.PlayersInMatch:GetChildren())]
CurrentPlayer = game.Players:FindFirstChild(NewCurrentPlayer.Name)
print('NewCurrentPlayer = ',CurrentPlayer,'.')
if CurrentPlayer then
Found = true
end
until Found == true or #workspace.PlayersInMatch:GetChildren() == 0
PNCPDebouunce = false
else
PNCPDebouunce = false
end
end
wait(15)
warn('Going to run')
Run()