I am currently working on a invite/party system, but I have a bug that I don’t know how to fix. I want to find a specific value on a folder, for example something like
FindFirstChild(Value)
But I’ve realized that using FindFirstChild only gets the name of the value, and not the actual value. Is there any way to make this work so that it finds the actual value instead of the value’s name?
I don’t know if that would work because the thing here is that, each of the values have a different name and I am trying to look for the specific value without having to use the value’s name (Sorry if that sounds confusing)
Okay, so basically I am scripting a party system, and everytime a player gets accepted into a lobby a value is cloned & it has a different name, (E.G, Player1, Player2, etc…)
And I want to do something like
local CheckDuplicate = playersServer.Players:FindFirstChild(asker)
if asker then return end
But the problem is that FindFirstChild only works with object names [From what I’ve heard] and I want to make it work so that it looks through the folder and detects that specific value, instead of detecting the value’s name.
for i, asker in pairs (playersServer.Players:GetChildren()) do
if asker.Name == "Something" then
end
end
If there is something different from the values’ class names, simply do
for i, asker in pairs (playersServer.Players:GetChildren()) do
if asker.ClassName == "IntValue" then -- You can change the class name, I don't what you are using
if asker.Name == "Something" then
end
end
end
Okay, so I’ve rewrote your script a little, and I am wondering if this would also work.
Here’s my script
remotes.AcceptInvite.OnServerEvent:Connect(function(player, asker)
print(asker)
if asker then
local server = game.ReplicatedStorage.Servers:FindFirstChild(player.Name .. " Server")
local children = server.Players:GetChildren()
for i, child in ipairs(children) do
if child.Value ~= asker.Name then
server.AmountOfPlayers.Value = server.AmountOfPlayers.Value + 1
print("Added Value")
local p_Clone = server.Players.Player1:Clone()
p_Clone.Value = asker.Name
p_Clone.Name = "Player" .. server.AmountOfPlayers.Value
print("Added Player")
p_Clone.Parent = server.Players
remotes.ClientRemotes.ShowPlayerScreen:FireClient(asker, server)
print("Sent Remote")
end
end
end
end)