Here is the code for the other scripts
JoinLobbyHandler (Client)
local frame = script.Parent:WaitForChild('JoinOpenGameFrame')
local backBTN = frame:WaitForChild('CloseMenu')
local mainframe = frame.Parent:WaitForChild('MainPlayMenuFrame')
local rep = game:GetService('ReplicatedStorage')
local CreateGameLobbyEvnt = rep:WaitForChild('events'):WaitForChild('RemoteEvents'):WaitForChild('CreateGameLobby')
local createLobbyEvent2 = rep:WaitForChild('events'):WaitForChild('RemoteEvents'):WaitForChild('CreateGameLobby2')
local createGameLobby3 = rep:WaitForChild('events'):WaitForChild('RemoteEvents'):WaitForChild('CreateGameLobby3')
local Scrolling_Frame = frame:WaitForChild('OpenGamesList')
local function closeFrame()
frame.Visible = false
for _,i in pairs(mainframe:GetChildren()) do
if i:IsA("TextButton") then -- makes all the buttons interactable.
i.Interactable = true
end
end
end
backBTN.MouseButton1Click:Connect(closeFrame)
local function createlobbyFunc(playerName, UserID, GameSize, Privacy)
local PlayerNameExample = frame:WaitForChild('OpenGamesList'):WaitForChild('PlayerNameExample')
local clone = PlayerNameExample:Clone()
clone.Name = playerName
clone.Parent = frame:WaitForChild('OpenGamesList')
clone.Visible = true
clone:WaitForChild('UsernameLBL').Text = playerName.." Lobby"
clone:WaitForChild('PlayerCount').Text = "1/"..GameSize
end
createLobbyEvent2.OnClientEvent:Connect(createlobbyFunc)
local function updVals(plrName, UserID, GameSize, Privacy)
local path_to_Frame = frame:WaitForChild('OpenGamesList')
local plrFrame = path_to_Frame:FindFirstChild(plrName)
print("Updating Vals Request Recieved For Lobby: "..plrName.."'s Lobby!")
local Game_ownerName = plrFrame:WaitForChild('OwnersName')
local Game_size = plrFrame:WaitForChild('GameSize')
local Game_Privacy = plrFrame:WaitForChild('GamePrivacy')
Game_ownerName.Value = plrName
Game_size.Value = GameSize
Game_Privacy.Value = Privacy
task.wait(1.2)
frame.Visible = false
frame.Parent:WaitForChild('MainPlayMenuFrame').Visible = false
game:GetService('ReplicatedStorage'):WaitForChild('events'):WaitForChild('RemoteEvents'):WaitForChild('CreateGameLobby4'):FireServer(UserID, plrName, "update")
for _,i in pairs(game:WaitForChild('Workspace'):WaitForChild('PlayerValues'):GetChildren()) do
if i.Name == plrName then
i:WaitForChild("IsInGroup").Value = true
i:WaitForChild('WhosGroup').Value = plrName
end
end
task.wait(2)
local playerValue = game:GetService('Workspace'):WaitForChild('PlayerValues'):WaitForChild('PlayersInLobby'):FindFirstChild(plrName)
if playerValue then
playerValue.Value = plrName
end
end
createGameLobby3.OnClientEvent:Connect(updVals)
local function JoinParty(User_Who_Joining)
local PlrName = game.Players.LocalPlayer
local IsInGroupValFolder = game:WaitForChild('Workspace'):WaitForChild('PlayerValues')
local value = IsInGroupValFolder:FindFirstChild(PlrName.Name):WaitForChild('IsInGroup')
if not value.Value then
print("Player not in lobby joining now...")
game:GetService('ReplicatedStorage'):WaitForChild('events'):WaitForChild('RemoteEvents'):WaitForChild('CreateLobbyVal2'):FireServer(PlrName.Name, "create_Vals")
game:GetService('ReplicatedStorage'):WaitForChild('events'):WaitForChild('RemoteEvents'):WaitForChild('CreateGameLobby4'):FireServer(PlrName.Name, User_Who_Joining, "update")
else
print("you are already in lobby")
end
end
game:GetService('ReplicatedStorage'):WaitForChild('events'):WaitForChild('BindableEvents'):WaitForChild('JoinParty_Event').Event:Connect(JoinParty)
Create Lobby Handler (Client)
-- Script to handle the "CreateGamesFolder" Frame.
local frame = script.Parent:WaitForChild('CreateGameFrame')
local backBTN = frame:WaitForChild('CloseMenu')
local mainframe = frame.Parent:WaitForChild('MainPlayMenuFrame')
local createButton = frame:WaitForChild('Create')
local errorMessage = frame:WaitForChild('ErrorMessage')
local successMessage = frame:WaitForChild("SuccessMessage")
local textbox = frame:WaitForChild('EnterPlayerAmount')
local lobbyPrivacyText = frame:WaitForChild('LobbyPrivacyLBL')
local privacy_publicBTN = frame:WaitForChild('PublicBTN')
local privacy_privateBTN = frame:WaitForChild('PrivateBTN')
local privacy_value = frame:WaitForChild('LobbyPrivacy')
lobbyPrivacyText.Text = "Party Privacy Not Set Yet!"
lobbyPrivacyText.TextColor3 = Color3.new(1,0,0)
local rep = game:GetService('ReplicatedStorage')
local CreateGameLobbyEvnt = rep:WaitForChild('events'):WaitForChild('RemoteEvents'):WaitForChild('CreateGameLobby')
local function closeFrame()
privacy_value.Value = ""
for _,i in pairs(mainframe:GetChildren()) do
if i:IsA("TextButton") then -- makes all the buttons interactable.
i.Interactable = true
end
end
end
backBTN.MouseButton1Click:Connect(closeFrame)
local function stripNONnumbers() -- Removes text that is not a number from the textbox.
textbox.Text = textbox.Text:gsub("%D","")
end
textbox:GetPropertyChangedSignal("Text"):Connect(stripNONnumbers) -- Runs the function when text is typed in the textbox
local function update_privacy() -- updates privacy
if privacy_value.Value == "" then
lobbyPrivacyText.Text = "Party Privacy Not Set Yet!"
lobbyPrivacyText.TextColor3 = Color3.new(1,0,0)
end
if privacy_value.Value == "public" then
lobbyPrivacyText.Text = "Lobby Privacy: Public"
lobbyPrivacyText.TextColor3 = Color3.new(0, 1, 0)
elseif privacy_value.Value == "private" then
lobbyPrivacyText.Text = "Lobby Privacy: Private"
lobbyPrivacyText.TextColor3 = Color3.new(1, 0, 0)
end
end
privacy_value.Changed:Connect(update_privacy)
privacy_publicBTN.MouseButton1Click:Connect(function()
privacy_value.Value = "public"
end)
privacy_privateBTN.MouseButton1Click:Connect(function()
privacy_value.Value = "private"
end)
local function createGame()
local playerName = game:GetService('Players').LocalPlayer.Name
local userID = game:GetService('Players').LocalPlayer.UserId
local privacy = privacy_value.Value
local gameSize = textbox.Text
local mps = game:GetService('MarketplaceService')
if mps:UserOwnsGamePassAsync(userID,814881978) then
gameSize = 24
else
gameSize = 4
end
CreateGameLobbyEvnt:FireServer(playerName, userID, privacy, gameSize)
game:GetService('ReplicatedStorage'):WaitForChild('events'):WaitForChild('RemoteEvents'):WaitForChild('CreateLobbyVal2'):FireServer(playerName, "create_Vals")
closeFrame()
end
createButton.MouseButton1Click:Connect(createGame)
Create Lobby Script (Server)
local rep = game:GetService('ReplicatedStorage')
local createLobbyEvent = rep:WaitForChild('events'):WaitForChild('RemoteEvents'):WaitForChild('CreateGameLobby')
local createLobbyEvent2 = rep:WaitForChild('events'):WaitForChild('RemoteEvents'):WaitForChild('CreateGameLobby2')
local createGameLobby3 = rep:WaitForChild('events'):WaitForChild('RemoteEvents'):WaitForChild('CreateGameLobby3')
local function createlobbyFunc(p, playerName, UserID, Privacy, GameSize)
playerName = tostring(playerName)
UserID = UserID
GameSize = tostring(GameSize)
Privacy = tostring(Privacy)
print("Lobby Creation Info:")
print("Name: "..playerName)
print("UserID: "..UserID)
print("Lobby Privacy: "..Privacy)
print("Lobby Size: "..GameSize)
createLobbyEvent2:FireAllClients(playerName, UserID, GameSize, Privacy)
createGameLobby3:FireAllClients(playerName, UserID, GameSize, Privacy)
end
createLobbyEvent.OnServerEvent:Connect(createlobbyFunc)
These are the important scripts which the error might be coming from.