Party System - OOP Party System

It’s an okay module, it be really helpful if you replicated the data to the client for GUI related stuff

Since you are using value objects anyway to store information you can just have the module use the value objects as references for data instead of using the OOP fields that don’t replicate

It probably also be helpful to have it when a member or leader leaves the game it updates the party info accordingly

Also its super strange to have the getparty function return a string “NoParty” why not just return it as nil?

otherwise I can’t do this

-- because a string value is considered a non-nil value the if statement passes
if partymodule:getParty(Player) then
    print("Has party!")
end

Also you don’t change the CurrentMemberCount field when removing members, which makes it bug out after getting 4 invites accepted

function Party:addMember(Member: Player)
	if self.CurrentMemberCount + 1 > self.MaxMembers then
		warn(("[%s:%s] Cannot add %s to party. Too many members!"):format(Member.Name, self.CurrentMemberCount, self.MaxMembers))
		return
	elseif table.find(self.Members, Member) then
		warn(("%s is already in the party."):format(Member.Name))
		return
	elseif table.find(self.Blacklist, Member) then
		warn(("%s is blacklisted from the party!"):format(Member.Name))
		return
	end

	table.insert(self.Members, Member)
	self.CurrentMemberCount += 1

	local newPhysicalMember = createNewInstance("ObjectValue", PhysicalParty.Members, Member.Name, Member)

	newPhysicalMember:SetAttribute("Leader", false)
	newPhysicalMember:SetAttribute("CanKick", false)
	newPhysicalMember:SetAttribute("CanInvite", false)
end
function Party:removeMember(Member: Player)
	if not table.find(self.Members, Member) then
		warn(("%s not in the party."):format(Member.Name))
		return
	elseif self.Leader == Member then
		warn("You cannot kick the leader from the party.")
		return
	end

	table.remove(self.Members, table.find(self.Members, Member))
	PhysicalParty.Members[Member.Name]:Destroy()
end
2 Likes

You can just do return self.InviteOnly to simplify it.

2 Likes

Hi,
Is there a .rbxl of this that someone change share with the latest updates?

Thanks

1 Like

Thanks for the feedback. I appreciate it. Most likely won’t change any of that on this model as I will re-create the system soon with my current knowledge, but will definitely implement this on the new one.

The model should be up to date, I haven’t touched this project in a while though so the last update was probably last year. I plan on re-making this system some time soon with my current knowledge though.

nice, if you make I newer version and would like some testers, hit me up!