It seems like my PlayerAdded event doesn’t register a player being added.
This is weird on itself, but what makes it weirder is that it only happens when I insert some folders with sounds into the workspace.
This is what happens when I leave the folders out:
This is what happens when I insert them:
These are the 2 folders with sounds:
They are just sounds.
This is the script that registers player added:
local ServerScriptSrv = game:GetService("ServerScriptService")
local Players = game:GetService("Players")
local Storage = game:GetService("ServerStorage")
local BackMapsClass = require( ServerScriptSrv.MapGeneration.BackMaps )
local BackPieceClass = require( ServerScriptSrv.MapGeneration.BackPiece )
local Settings = require( script.Settings )
local BackMaps = BackMapsClass.new(Settings)
local AppendPieceEvent = script.AppendPiece
local Configuration = ServerScriptSrv.Configuration
local Pieces = Storage.Pieces
local Slocked = false
local ActiveMapGeneration = false
local Chr
Players.PlayerAdded:Connect(function(Plr)
print("PA") -- Prints when folder is left out, doesn't print when it's in!
if Slocked == false then
Slocked = true
Plr.CharacterAdded:Connect(function(NewChr)
Chr = NewChr
Chr:WaitForChild("HumanoidRootPart").Anchored = true
end)
local FirstPiece = BackMaps:NewPiece( nil, tostring(Configuration.CurrentLevel.Value), Plr )
local FirstBackPieceClass = BackPieceClass.new(FirstPiece, Plr, Settings)
FirstBackPieceClass:ThreadPiece()
ActiveMapGeneration = true
repeat task.wait(.1) until Chr
Chr.Parent = workspace.Characters
Chr:SetPrimaryPartCFrame(FirstPiece.PrimaryChunkRoot.CFrame)
Chr:WaitForChild("HumanoidRootPart").Anchored = false
elseif Slocked == true then
Plr:Kick("Server is full.")
end
end)
I left some unimportant stuff out of this script, but could it be that all of the stuff above the PlayerAdded or just the size of the workspace takes so long to load that it doesn’t register a player joining?