I'm writing a quick playerRequirementCheck loop for a Round Based Game. The issue here is that it's not actually checking for the number of Players again after the first "failure", or so what I'm reading from Debug Statements; prints. Everything doesn't seem to work, only in Play Solo does things function properly, following all the requested statements in Output
[As I say "PlayerUI Reader", I'm referring to the ol' Status Bar, a StringValue called 'Currentinfo' withholding each instructed String passed by the 'CoreScript', picked up by the 'Reader' LocalScript inside of the Players UI, updating the TextLable to the Currentinfo's value.]
Heres the playerCheck loop
while wait() do
print("PlrCheck?")
AllPlayers = {}
for _,Player in pairs(game:GetService("Players"):GetPlayers()) do
if Player and Player.Character then
if Player.Character.Humanoid then
table.insert(AllPlayers, Player)
end
end
end
if #AllPlayers < RequiredPlayerCount then
if not InsufficientPlayers then
Script.SetString(Currentinfo, "Waiting for "..RequiredPlayerCount.." players..."); InsufficientPlayers = true
print("PlrCheck_below")
elseif #AllPlayers >= RequiredPlayerCount then
if InsufficientPlayers then
Script.SetString(Currentinfo, "Sufficient Players!"); wait(1); InsufficientPlayers = false
print("PlrCheck_enough;push")
end
break
end
end
end;
Heres the function used to Shortcut the Currentinfo Instance.
Script = {
SetString = function(SetInstance, String)
if not SetInstance then
error("Unable to Set String for instance '"..SetInstance.."' (Propterty doesn't exist).")
end
SetInstance.Value = String, print(Currentinfo.Value, String, SetInstance)
end;
};
This is the Reader
local Currentinfo = game:GetService("ReplicatedStorage"):WaitForChild("Other").Currentinfo
local Player = game:GetService("Players").LocalPlayer; local Header = Player:WaitForChild("PlayerGui").BaseGuis.BaseHeader.Header
local function SetHeader()
print("SetHeaderRunning?")
if Currentinfo then print("CIRemotePresent[SetHeaderCheck]")
local Header = Player:WaitForChild("PlayerGui").BaseGuis.BaseHeader.Header; if Header then print("HeaderPresent") end
Header.Text = Currentinfo.Value; if Header.Text == Currentinfo.Value then print('"'..Currentinfo.Value..'"_UpdatedHdr') end
end;
end;
Currentinfo:GetPropertyChangedSignal("Value"):Connect(SetHeader)
This is the Output for all Statements, any other called aren't there
PlrCheck? Waiting for 3 players... Currentinfo PlrCheck_below PlrCheck? (x[inf#]) - repeated
The Header is a GUI placed at the top of the Screen, it rests at "Default", the Reader isn't responding, nor functioning. It should rest at "Waiting for 3 players..."
If I am stupid enough to not see anything, please help me. Thanks
