I can’t think of a way to get the party owner from the client side to update the UI for the party. I tried using remote events but the output just came as nil. Thanks for the help!
Server Script:
game.Players.PlayerAdded:Connect(function(plr)
local partycode = Instance.new('StringValue', plr)
partycode.Name = 'PartyCode'
local inparty = Instance.new('StringValue', plr)
inparty.Name = 'InPlayersParty'
local playernumber = Instance.new('StringValue', plr)
playernumber.Name = 'PlayerNumber'
end)
game.ReplicatedStorage:WaitForChild('Createparty').OnServerEvent:Connect(function(plr)
if game.ReplicatedStorage.Parties:FindFirstChild(plr.Name) then end
local newfolder = Instance.new('Folder', game.ReplicatedStorage.Parties)
newfolder.Name = plr.Name
local plr1 = Instance.new('StringValue', newfolder)
plr1.Name = 'PartyOwner'
plr1.Value = plr.Name
plr. PlayerNumber.Value = '1'
--plr.InPlayersParty.Value = plr.Name
end)
game.ReplicatedStorage:WaitForChild('Joinparty').OnServerEvent:Connect(function(plr)
for i,v in pairs(game.Players:GetChildren()) do
if v.PartyCode.Value == plr.PlayerGui.MainMenu.Frame.LobbyPage.Box1.InputPassword.TextBox.Text then
local partyownerfolder = game.ReplicatedStorage.Parties:FindFirstChild(v.Name)
local counter = 0
for e,f in pairs(partyownerfolder:GetChildren()) do
counter = counter + 1
end
if counter == 1 then
local plr2 = Instance.new('StringValue', partyownerfolder)
plr2.Name = 'Player2'
plr2.Value = plr.Name
plr.InPlayersParty.Value = v.Name
plr. PlayerNumber.Value = '2'
elseif counter == 2 then
local plr3 = Instance.new('StringValue', partyownerfolder)
plr3.Name = 'Player3'
plr3.Value = plr.Name
plr.InPlayersParty.Value = v.Name
plr. PlayerNumber.Value = '3'
elseif counter == 3 then
local plr4= Instance.new('StringValue', partyownerfolder)
plr4.Name = 'Player4'
plr4.Value = plr.Name
plr.InPlayersParty.Value = v.Name
plr. PlayerNumber.Value = '4'
else
plr.PlayerGui.MainMenu.Frame.LobbyPage.Box1.InputPassword.TextBox.Text = ''
plr.PlayerGui.MainMenu.Frame.LobbyPage.Box1.InputPassword.TextBox.PlaceholderText = 'Party is Full!'
end
end
end
end)
Local Script:
local plr = game.Players.LocalPlayer
script.Parent.Create.MouseButton1Click:Connect(function()
-- script.Parent.Box1.Visible = false
game.ReplicatedStorage.Createparty:FireServer(plr)
script.Parent.Parent.Parent.BarFrame.Party.PartyName.Text = plr.Name.. "'s Party"
script.Parent.Parent.Parent.BarFrame.Party.Player1.Image = game.Players:GetUserThumbnailAsync(plr.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)
script.Parent.Parent.Parent.BarFrame.Party.Player1.Player1Name.Text = plr.Name
end)
script.Parent.InputCodeBox.TextBox.FocusLost:Connect(function()
if game.ReplicatedStorage.Parties:FindFirstChild(plr.Name) then
plr.PartyCode.Value = script.Parent.InputCodeBox.TextBox.Text
else
script.Parent.InputCodeBox.TextBox.Text =''
script.Parent.InputCodeBox.TextBox.PlaceholderText = 'Create A Party First!'
wait(2)
script.Parent.InputCodeBox.TextBox.PlaceholderText = ''
script.Parent.Parent.Parent.BarFrame.Party.RoomCode.Text = plr.PartyCode.Value
end
end)
script.Parent.Box1.Confirm.MouseButton1Click:Connect(function()
if script.Parent.Box1.InputPassword.TextBox.Text ~= '' then
for i,v in pairs(game.Players:GetChildren()) do
if v.PartyCode.Value == script.Parent.Box1.InputPassword.TextBox.Text then
game.ReplicatedStorage.Joinparty:FireServer(plr)
script.Parent.Box1.InputPassword.TextBox.Text = ''
script.Parent.Box1.InputPassword.TextBox.PlaceholderText = 'Joining Party'
else
script.Parent.Box1.InputPassword.TextBox.Text = ''
script.Parent.Box1.InputPassword.TextBox.PlaceholderText = 'Party Code Is Incorrect'
end
end
else
script.Parent.Box1.InputPassword.TextBox.Text = ''
script.Parent.Box1.InputPassword.TextBox.PlaceholderText = 'Enter A Party Code!'
end
end)