Im trying to make a party system and when I make the button, a clone, I need to detect which player clicks it so they join the party. However, im not sure how to do this. I tried to put player into the mousebuttonclicked function but that prints nil.
local frame = script.Parent
game.ReplicatedStorage.CreateParty.OnServerEvent:Connect(function(plr)
if plr.RegularValues.PartyCreation.Value == false then
game.ServerStorage.ServerValues.Servers.Value += 1
local val = game.ServerStorage.ServerValues.Servers.Value
local players = {plr.Name}
local partyBox = frame.PartyExample:Clone()
partyBox.Parent = frame
partyBox.Visible = true
partyBox.Position = UDim2.fromScale(0.046, 0.013 + (val - 1)*0.060)
partyBox.Name = "PartyBox"
partyBox.Text = plr.Name.. "'s Party (1/5)"
partyBox.MouseEnter:Connect(function()
partyBox.BackgroundTransparency = 0.4
end)
partyBox.MouseLeave:Connect(function()
partyBox.BackgroundTransparency = 0.6
end)
print(players)
partyBox.MouseButton1Click:Connect(function(player)
print(player)
if player.RegularValues.PartyCreation.Value == false then
table.insert(players, player)
end
end)
end
end)