I'm trying to make plots and and I have a plots folder, a plot model in the folder, and a string value named owner in the plot model. I'm trying to make a function that finds a plot where the owner value is equal to nothing, and if it is, it will set the owner value to the players name. If the owner value already has the value of a players name, it will find another plot that is empty. How can I do this?
I hope I explained that well enough, thank you!
You can use a
for — do loop
local folder = -- ur folder local plots = folder:GetChildren() for _,plot in pairs(plots) do local value = plot.Value -- specify where the value is if value.Value == " " or value.Value == "" then -- how is it set to nothing? is it " " or "" -- do your function if the plot is empty else return nil -- you don't need this "else" part but just incase it makes things more clear end end
Hope that helps