Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Find an empty plot with no owner?

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!

1 comment

0

You can use a for -- do loop

1 answer

✓ Accepted answer

You can use a for — do loop

https://developer.roblox.com/en-us/articles/Loops

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

This discussion is preserved as it was. New answers, comments, and votes are closed.