Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Client
- --//Services
- local Players = game:GetService("Players")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- --//Variables
- local Player = Players.LocalPlayer
- local Assets = ReplicatedStorage:WaitForChild("Assets")
- local Remotes = ReplicatedStorage:WaitForChild("Remotes")
- local Parties = Assets:WaitForChild("Parties")
- local MyParty = Parties:WaitForChild(Player.UserId.."'s party")
- local Events = Remotes.Events
- local Functions = Remotes.Functions
- local UI = Assets.UI
- local GUI = script.Parent
- local Main = GUI:WaitForChild("Main")
- local Invite = Main.Invite
- local InviteCoolDown = false
- --//Functions
- local function CheckForPlayersYouMissed()
- for i,player in pairs(Players:GetPlayers()) do
- if Invite:FindFirstChild(player.UserId) == nil and player ~= Player then
- local Template = UI.InviteTemplate:Clone()
- Template.Parent = Invite
- Template.Name = player.UserId
- Template.Text = player.Name
- Template.MouseButton1Click:Connect(function()
- if not InviteCoolDown then
- InviteCoolDown = not InviteCoolDown
- Events:FireServer("Invite",{tonumber(Template.Name)}) -- tell the server they want to invite the player
- wait(4)
- InviteCoolDown = not InviteCoolDown
- end
- end)
- end
- end
- end
- local function FindInTable(index,tbl)
- for i,v in pairs(tbl) do
- if i == index then
- return v
- end
- end
- end
- --//Events
- Players.PlayerAdded:Connect(function(player)
- if Invite:FindFirstChild(player.UserId) == nil and player ~= Player then
- local Template = UI.InviteTemplate:Clone()
- Template.Parent = Invite
- Template.Name = player.UserId
- Template.Text = player.Name
- Template.MouseButton1Click:Connect(function()
- if not InviteCoolDown then
- InviteCoolDown = not InviteCoolDown
- Events:FireServer("Invite",{tonumber(Template.Name)}) -- tell the server they want to invite the player
- wait(4)
- InviteCoolDown = not InviteCoolDown
- end
- end)
- end
- end)
- Players.PlayerRemoving:Connect(function(player)
- if Invite:FindFirstChild(player.UserId) ~= nil and player ~= Player then
- Invite:FindFirstChild(player.UserId):Destroy() -- remove their stuff since they left
- end
- end)
- Functions.OnClientInvoke = function(Command,ArgumentTable)
- end
- Events.OnClientEvent:Connect(function(Command,ArgumentTable)
- if Command == "AddPlayerToMM" then
- local AddPlayer = ArgumentTable.Player
- local PartyPlace = ArgumentTable.PartyPlace
- Main.Party:FindFirstChild("Player"..PartyPlace).Player.Text = AddPlayer.Name
- Main.Party:FindFirstChild("Player"..PartyPlace).Icon.Image = "https://www.roblox.com/bust-thumbnail/image?userId="..AddPlayer.UserId.."&width=420&height=420&format=png"
- if AddPlayer == Player then
- if PartyPlace == 1 then
- Main.Ready.Visible = true
- else
- Main.Ready.Visible = false
- if Main.Party.Player1.Player.Text == Player.Name then
- Main.Ready.Visible = true
- end
- end
- end
- elseif Command == "ENDPARTY" then
- for i,v in pairs(Main.Party:GetChildren()) do
- if v.Name ~= "Player1" then
- v.Icon.Image = "rbxasset://textures/ui/GuiImagePlaceholder.png"
- v.Player.Text = "PlayerName"
- else
- v.Player.Text = Player.Name
- v.Icon.Image = "https://www.roblox.com/bust-thumbnail/image?userId="..Player.UserId.."&width=420&height=420&format=png"
- end
- end
- Main.Ready.Visible = true
- Main.BadNews.Visible = true
- wait(string.len(Main.BadNews.Text)/20)
- Main.BadNews.Visible = false
- elseif Command == "Invited" then
- local PlayerFrom = ArgumentTable.From
- Main.Invited.Visible = true
- Main.Invited.Message.Text = PlayerFrom.Name.." has invited you to a party, would you like to join?"
- Main.Invited.Yes.MouseButton1Click:Connect(function()
- Main.Invited.Visible = false
- Events:FireServer("AcceptInvite",{From = PlayerFrom,Key = ArgumentTable.InviteID})
- end)
- Main.Invited.No.MouseButton1Click:Connect(function()
- Main.Invited.Visible = false
- Events:FireServer("DeclineInvite",{From = PlayerFrom,Key = ArgumentTable.InviteID})
- end)
- elseif Command == "AddAllToNewParty" then
- local PlayersTable = ArgumentTable.Players
- for i,v in pairs(Main.Party:GetChildren()) do
- local Find = FindInTable(i,PlayersTable)
- if Find ~= nil then
- if Players:GetPlayerByUserId(tonumber(Find)) == Player then
- if i == 1 then
- Main.Ready.Visible = true
- else
- Main.Ready.Visible = false
- end
- end
- end
- if Find ~= nil then
- v.Player.Text = Players:GetPlayerByUserId(tonumber(Find)).Name
- v.Icon.Image = "https://www.roblox.com/bust-thumbnail/image?userId="..Find.."&width=420&height=420&format=png"
- else
- v.Icon.Image = "rbxasset://textures/ui/GuiImagePlaceholder.png"
- v.Player.Text = "PlayerName"
- end
- end
- end
- end)
- Main.Ready.MouseButton1Click:Connect(function()
- Events:FireServer("Ready")
- end)
- --//Main
- Main.Ready.Visible = true
- CheckForPlayersYouMissed()
- if MyParty ~= nil then
- if tonumber(MyParty.Party["1"].Value) == Player.UserId then
- Main.Party.Player1.Player.Text = Player.Name
- Main.Party.Player1.Icon.Image = "https://www.roblox.com/bust-thumbnail/image?userId="..Player.UserId.."&width=420&height=420&format=png"
- end
- end
- local CheckIfServerIsReserved = Functions:InvokeServer("IsReserved?")
- if CheckIfServerIsReserved then
- Main.Visible = false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement