local plr = game.Players.LocalPlayer
local Main = plr.PlayerGui:WaitForChild("Main")
local How = Main:WaitForChild("How")
local HowFrame = How:WaitForChild("HowFrame")
local HowFramePos = HowFrame.Position
local Party = Main:WaitForChild("Party")
local PartyButton = Party:WaitForChild("TextButton")
local PartyFrame = Party:WaitForChild("PartyFrame")
local MemberFrame = PartyFrame:WaitForChild("MemberFrame")
local inviteBox = PartyFrame:WaitForChild("TextBox")
local Name = PartyFrame:WaitForChild("Name")
local PartyFramePos = PartyFrame.Position
local party = game.ReplicatedStorage:WaitForChild("Parties"):WaitForChild(plr.Name)
local lastParty = game.ReplicatedStorage:WaitForChild("Parties"):WaitForChild(plr.Name)
local GetChildren = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("GetChilds")
local GetParty = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("GetParty")
local GetValue = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("GetValue")
local GetName = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("GetName")
local connection1 = nil
local connection2 = nil
local function setPartyInfo()
for i,v in MemberFrame:GetChildren() do
if v:IsA("Frame") then
print(v.NameLabel.Text)
v:Destroy()
end
end
print(party, party:GetChildren())
local children = GetChildren:InvokeServer(party)
print("Children..", children)
Name.Text = GetName:InvokeServer(GetValue:InvokeServer(party.Leader)).."'s party: "..#children-1 .."/2"
local leader = GetValue:InvokeServer(party.Leader)
for i,v in children do
print(v.Name)
if v:IsA("ObjectValue") and GetName:InvokeServer(v) ~= "Leader" then
local MemberTemplate = script:WaitForChild("Templates"):WaitForChild("MemberTemplate"):Clone()
MemberTemplate.Parent = MemberFrame
local content = game.Players:GetUserThumbnailAsync(v.Value.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
MemberTemplate.ImageLabel.Image = content
print(v, v.Value.Name)
MemberTemplate.NameLabel.Text = v.Value.Name
if plr ~= leader then return end
if v.Value ~= plr then
MemberTemplate.TextButton.Visible = true
end
end
end
end
setPartyInfo()
connection1 = party.ChildAdded:Connect(setPartyInfo)
connection2 = party.ChildRemoved:Connect(setPartyInfo)
local ts = game:GetService("TweenService")
How:WaitForChild("TextButton").MouseButton1Click:Connect(function()
local visible = not HowFrame.Visible
if visible == true then
HowFrame.Visible = true
HowFrame.Position = HowFramePos - UDim2.new(0,0,0,40)
local tweenIn = ts:Create(HowFrame, TweenInfo.new(0.5), {Position = HowFramePos + UDim2.new(0,0,0,40), Transparency = 0.3})
for i,v in HowFrame:GetDescendants() do
if v:IsA("TextLabel") then
ts:Create(v, TweenInfo.new(0.5), {TextTransparency = 0}):Play()
elseif v:IsA("UIStroke") then
ts:Create(v, TweenInfo.new(0.5), {Transparency = 0}):Play()
end
end
tweenIn:Play()
else
local tweenOut = ts:Create(HowFrame, TweenInfo.new(0.5), {Position = HowFramePos - UDim2.new(0,0,0,80), Transparency = 1})
for i,v in HowFrame:GetDescendants() do
if v:IsA("TextLabel") then
ts:Create(v, TweenInfo.new(0.5), {TextTransparency = 1}):Play()
elseif v:IsA("UIStroke") then
ts:Create(v, TweenInfo.new(0.5), {Transparency = 1}):Play()
end
end
tweenOut:Play()
tweenOut.Completed:Connect(function()
task.wait()
HowFrame.Visible = visible
end)
end
end)
PartyButton.MouseButton1Click:Connect(function()
local visible = not PartyFrame.Visible
if visible == true then
PartyFrame.Visible = true
PartyFrame.Position = PartyFramePos - UDim2.new(0,0,0,40)
local tweenIn = ts:Create(PartyFrame, TweenInfo.new(0.5), {Position = PartyFramePos + UDim2.new(0,0,0,40), Transparency = 0.3})
for i,v in PartyFrame:GetDescendants() do
if v:IsA("TextLabel") or v:IsA("TextButton")then
ts:Create(v, TweenInfo.new(0.5), {TextTransparency = 0}):Play()
elseif v:IsA("UIStroke") then
ts:Create(v, TweenInfo.new(0.5), {Transparency = 0}):Play()
end
end
tweenIn:Play()
else
local tweenOut = ts:Create(PartyFrame, TweenInfo.new(0.5), {Position = PartyFramePos - UDim2.new(0,0,0,80), Transparency = 1})
for i,v in PartyFrame:GetDescendants() do
if v:IsA("TextLabel") or v:IsA("TextBox") then
ts:Create(v, TweenInfo.new(0.5), {TextTransparency = 1}):Play()
elseif v:IsA("UIStroke") or v:IsA("ImageLabel") or v:IsA("ScrollingFrame") or v:IsA("Frame") then
ts:Create(v, TweenInfo.new(0.5), {Transparency = 1}):Play()
end
end
tweenOut:Play()
tweenOut.Completed:Connect(function()
task.wait()
PartyFrame.Visible = visible
end)
end
end)
inviteBox.FocusLost:Connect(function(enter)
if #GetChildren:InvokeServer(party) <= 1+1 then
if enter then
for i,v in game.Players:GetPlayers() do
for i1,v1 in GetChildren:InvokeServer(party) do
if v1.Value == v.Name then
return
end
end
if inviteBox.Text == v.Name then
game.ReplicatedStorage.Remotes.PartyInvite:FireServer(v)
end
end
end
else
inviteBox.Text = "Party size too big!"
end
end)
game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("PartyInvite").OnClientEvent:Connect(function(leader)
PartyFrame.Visible = true
inviteBox.Visible = false
PartyFrame.TextLabel.Visible = false
party = GetParty:InvokeServer(leader)
connection1:Disconnect()
connection2:Disconnect()
connection1 = party.ChildAdded:Connect(setPartyInfo)
connection2 = party.ChildRemoved:Connect(setPartyInfo)
print(party)
game.ReplicatedStorage.Remotes.JoinParty:FireServer(leader)
end)
basically the ui looks as it should for the person who inviites another player, basically when they invite there is two “membertemplates” one for player1 who invited and one for player2, but on player2s screen there is just one for player1 and no membertemplate for player2