#Party system

1 messages · Page 1 of 1 (latest)

silk geyser
#

Server Script

local MessageNotification = game:GetService("ReplicatedStorage").MessageNotification
local Players = game:GetService("Players")
local PlayersTable = {}

local function createData(Table)
    for i, player in Table do
        local Player = Players:FindFirstChild(tostring(player.Name))
        local Party = Player:WaitForChild("Party")
        if Party:FindFirstChild(Player.Name) then continue end
        local str = Instance.new("StringValue", Party)
        str.Name = Player.Name
    end
end

MessageInvite.OnServerEvent:Connect(function(Player, PlayerToInvite)
    local PlayerToInviteObject = Players:FindFirstChild(PlayerToInvite)
    if PlayerToInviteObject == nil then
        print("Player does not exist")
        return
    end
    MessageInvite:FireClient(PlayerToInviteObject, Player)
    table.insert(PlayersTable, Player)
    createData(PlayersTable)
end)

MessageNotification.OnServerEvent:Connect(function(Player, InviteHost, InviteStatus)
    print(Player.Name)
    if InviteStatus == "Accepted" then
        table.insert(PlayersTable, Player)
        createData(PlayersTable)
    end
end)```
#

Local script

local MessageInvite = game:GetService("ReplicatedStorage").MessageInvite
local MessageNotification = game:GetService("ReplicatedStorage").MessageNotification
local Player = Players.LocalPlayer
local Ui = script.Parent
local Button = Ui.OpenPlayers
local MFrame = Ui:WaitForChild("MFrame")
local IFrame = Ui.InviteFrame
local InviteText = IFrame.TextLabel
local SFrame = MFrame.ScrollingFrame
local NameButton = SFrame.name
local RejectButton = IFrame.Reject
local AcceptButton = IFrame.Accept
local NameButtonsFolder = SFrame.NameButtons

local function Clear(Folder, exceptions)
    for i, v in Folder:GetChildren() do
        if v.Name == exceptions then continue end
        v:Destroy()
    end
end

Button.Activated:Connect(function()
    MFrame.Visible = not MFrame.Visible
    Clear(NameButtonsFolder, "UIListLayout")
    for i, player in Players:GetPlayers() do
        local Clone = NameButton:Clone()
        Clone.Name = "name"
        Clone.Parent = NameButtonsFolder
        Clone.Visible = true
        Clone.Text = player.Name
        Clone.Activated:Connect(function()
            print("activated")
            MessageInvite:FireServer(Clone.Text)
        end)
    end
end)

MessageInvite.OnClientEvent:Connect(function(player)
    local InviteHost = Players:FindFirstChild(tostring(player))
    if InviteHost then
        InviteText.Text = InviteHost.Name.. " has invited you to join their party"
        IFrame.Visible = true
        AcceptButton.Activated:Connect(function()
            print("accepted")
            IFrame.Visible = false
            MessageNotification:FireServer(InviteHost, "Accepted")
        end)
    end
end)

RejectButton.Activated:Connect(function()
    IFrame.Visible = false
end)
harsh geyser
ivory arch
#
local Parties = {
    Z3SCParty = {
        Z3SC,
        Kai,
        Suphi_Guardian,
    },
    BuldermanParty = {
        Builderman,
    }
}```
#

Like dat?

#

When a player creates a party you can add a TAG onto the gui that represents the key in this party table

#

So a TAG Z3SCParty and BuildermanParty on the part Gui's

#

And when clicked could just send the tag to the server and then add da player?

coarse crown
#

can you put it all in a .rbxl file that we can load into studio and work on getting it to work? @silk geyser

cinder tartan
#

I have a party script I can send you

#

You’ll have to wait til I get home though

cinder tartan
#

This script was from an old game so if you use it, it'll need tweaking

silk geyser
#

I want to make my own

coarse crown
silk geyser
coarse crown
silk geyser
#

it only works for the client

#

idk why