When I try to assign a player to the plot, the player gets assigned to all of them:
Ask if I need to clarify.
Players.PlayerAdded:Connect(function(player)
for _,plot in pairs(game.Workspace:GetChildren()) do
if plot.Name == "Plot" then
for _,plotOwner in pairs(plot:GetChildren()) do
if plotOwner.Value == nil then
plotOwner.Value = player
print(plotOwner.Value)
end
end
end
end
end)
You seem to be looping through every individual child in the plot? You can simply just do:
Players.PlayerAdded:Connect(function(player)
for _,plot in pairs(game.Workspace:GetChildren()) do
if plot.Name == "Plot" then
if plot:FindFirstChild("plotOwner").Value == nil then
--assign value
end
end
end
return false
end)
Can’t guarantee this will work, but your code is using much more lines than it needs
You could most likely take that part out and it’ll still function as intended, but let’s say this code was nested inside of a function, you can return false instead of nothing so you know that the for loop didn’t find any matches