How does this work?

  1. What do you want to achieve? Understanding this Line of code

  2. What is the issue? I want to understand it, but I didn’t find anything in the documenation or devforum or youtube.

  3. What solutions have you tried so far? looking on documentation, youtube and devforum.

local Plots = game.Workspace.Plots

game.Players.PlayerAdded:Connect(function(player)
	for _, plot in Plots:GetChildren() do
		if plot:GetAttribute("Taken") then continue end
		print("something")
		
	end
end)

so It prints 6 times “something” because they are 6 parts in the folder.
The thing is, why it does even print?
I did that if there is a atrribute called “Taken” then it will go to the next Line, but I didn’t even add any attributes, so how is that possible that it goes to the next line and prints?

You just need to put the print inside the if loop, using continue won’t work.

local Plots = game.Workspace.Plots

game.Players.PlayerAdded:Connect(function(player)
	for _, plot in Plots:GetChildren() do --Repeat for however many plots there are
		if plot:GetAttribute("Taken") then continue end --The issue is here. The script will continue regardless of if there is an attribute.

		print("something")
		
	end
end)

ohhh the script will continue, no matter if there is attribute or not!!!

After so many Hourse I understood it.
Man Thank you so so so much.
Big W

1 Like

No problem pal! Happy to help.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.