Howdy
I’m having issues with this grouping system for a special project of mines. I was able to figure out how to allow users to join your squad(A folder of information regarding the Player is placed within a pre-established group folder that was created when you started a group), but the issue is I can’t fathom how to allow users to leave/disband a squad
Below are 2 examples of where I’m certain the issue is cropping up. It seems that on the Server Example, nothing is printing passed “if Group.Members:FindFirstChild(Player.Name) then”, whilst on the Client Example, nothing is printing past “if LeaveSquadRequest == “Success” then”. It’s leading me to understand that “Success” isn’t being properly passed from Server to Client, but I don’t understand how I went wrong.
Note: Please do not worry about the areas that have “StudioMode” written in them, it’s just something I use to easily enable and disable print statements whilst testing.
Server Example:
Remotes.LeaveSquad.OnServerInvoke = function(Player)
for i, Group in pairs(Groups:GetChildren()) do
if Group.Members:FindFirstChild(Player.Name) then
if StudioMode then
print("Find Player from Group.Members")
end
for i,Member in pairs(Group.Members:GetChildren()) do
if StudioMode then
print("Indexed Member")
end
if Member.Name ~= Player.Name and Member.Position.Value > Group.Members:FindFirstChild(Player.Name).Position.Value then
if StudioMode then
print("Found")
end
Member.Position.Value -= 1
if StudioMode then
print("0")
end
Member.Color.Value = colorTable[Member.Position.Value]
if StudioMode then
print("Black")
end
if Member.Position.Value == 1 then
Member.IsLeader.Value = true
end
end
end
Group.Members:FindFirstChild(Player.Name):Destroy()
if #Group.Members:GetChildren() == 0 then
Group:Destroy()
if StudioMode then
print("Destroy")
end
end
return "Success"
end
end
return "You're not in a squad"
end
Client Example:
Leave.MouseButton1Click:Connect(function()
if StudioMode then
print("Get pressed")
end
if Values.Play.InSquad.Value == true then
local LeaveSquadRequest = Remotes.LeaveSquad:InvokeServer()
local UIPageLayout = MainContainer.Content.UIPageLayout
if LeaveSquadRequest == "Success" then
if StudioMode then
print("Stay")
end
Values.Play.InSquad.Value = false
Values.Play.CurrentSquad.Value = Values
if StudioMode then
print("Reset")
end
end
end
if StudioMode then
print("Leave Squad has been pressed")
end
end)
Due to these issues, the actual lobby list itself isn’t updating, pre-existing squad folders don’t get destroyed, and player information within said folder aren’t reset and deleted(which is of course to symbolize that the player is no longer queued). Really the only thing that works in these spots is a print statement that tells you that the button was pressed if you were to put it at the very beginning.
Some clarification/A push in the right direction would be greatly appreciated!