You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
i am making a lobby system like apeirophobia, where you can change whether its private or public, name the lobby, add a password and more -
What is the issue? Include screenshots / videos if possible!
whenever the lobby host leaves the lobby, the lobby/party is supposed to kick every player inside the lobby out and delete the lobby, it does delete the lobby but it doesnt kick everyone out, only the host leaves. which causes everyone to be stuck in the lobby. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
p.s. im only sharing the important parts, i can confirm though there are no errors present throughout the scripts
Block Of Server Script
elseif instruction == 'leaveLobby' then
local currentlobby = script.Parent.CurrentLobby.Value
if currentlobby then
if currentlobby.LobbyHost.Value == player.Name then
print('host left')
for i, playerInParty in pairs(currentlobby.Players:GetChildren()) do
game:GetService('Players'):FindFirstChild(playerInParty.Name).PlayerGui.TvScreenUI.InLobby.Value = false
game:GetService('Players'):FindFirstChild(playerInParty.Name).PlayerGui.TvScreenUI.CurrentLobby.Value = nil
script.Parent.LobbySystemRE:FireClient(game:GetService('Players'):FindFirstChild(playerInParty.Name), 'leaveLobby')
end
currentlobby:Destroy()
else
player.PlayerGui.TvScreenUI.InLobby.Value = false
script.Parent.LobbySystemRE:FireClient(player, 'leaveLobby')
for i, playr in pairs(game:GetService('ReplicatedStorage').Parties:FindFirstChild(lobbyname).Players:GetChildren()) do
script.Parent.LobbySystemRE:FireClient(game.Players:FindFirstChild(playr.Name), 'playerChange', lobbyname)
print(playr.Name)
end
currentlobby.Players:FindFirstChild(player.Name):Destroy()
player.PlayerGui.TvScreenUI.CurrentLobby.Value = nil
end
end
end
blocks of local script
local function refreshlobby()
local lobbies = game:GetService('ReplicatedStorage').Parties:GetChildren()
for _, oldlob in pairs(script.Parent.Desktop.Lobbies.lobbyList.ScrollingFrame:GetChildren()) do
if oldlob:IsA('Frame') then
oldlob:Destroy()
end
end
for _, lobby in pairs(lobbies) do
local lobbygui = game:GetService('ReplicatedStorage').LobbyTemplate:Clone()
lobbygui.Parent = script.Parent.Desktop.Lobbies.lobbyList.ScrollingFrame
lobbygui.Name = lobby.Name
lobbygui.LobbyName.Text = lobby.Name
lobbygui.plrname.Text = '@'..lobby.LobbyHost.Value
lobbygui.Queue.Text = #lobby:FindFirstChild('Players'):GetChildren()..'/'..lobby.MaxPlayers.Value
lobbygui.availability.Text = lobby.LobbyType.Value
lobbygui.LobbyFolder.Value = lobby
end
for _, lobby in pairs(script.Parent.Desktop.Lobbies.lobbyList.ScrollingFrame:GetChildren()) do
if lobby:IsA('Frame') then
lobby.Join.Activated:Connect(function()
screenpart.MouseClick:Play()
lobbysystemre:FireServer('joinLobby', lobby.Name, lobby.LobbyFolder.Value.MaxPlayers.Value, lobby.LobbyFolder.Value.Password.Value)
end)
end
end
end
currentlobby.Buttons.Leave.Activated:Connect(function()
screenpart.MouseClick:Play()
lobbysystemre:FireServer('leaveLobby', lobbies.createLobby.LobbyName.Text, lobbies.createLobby.PlayerLimit.Text, lobbies.createLobby.Password.Text)
refreshlobby()
end)
lobbysystemre.OnClientEvent:Connect(function(instruction, lobbyname)
if instruction == 'leaveLobby' then
tweenservice:Create(currentlobby.UIScale, tweeninfo, {Scale = 0.00}):Play()
currentlobby.Visible = false
tweenservice:Create(lobbies.UIScale, tweeninfo, {Scale = 1.00}):Play()
lobbies.Visible = true
refreshlobby()
end
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.