Hello fellow devs! I have a fairly simple question this fine, fine evening.
I know in JavaScript, you can use the
return;
command to restart a for loop, etc.
I was wondering how I could do that with Lua.
My Code (The issue):
-- This is wrapped in a bigger for loop.
if (Part:IsA("Part")) == false or Part.Name == "Solid" then
print("Removed".. Part.Name)
break -- I have also tried "return".
end
Full code:
local Model = script.Parent
wait(5)
for Model, Part in pairs(Model:GetChildren()) do
print(Part.Name)
if (Part:IsA("Part")) == false or Part.Name == "Solid" then
print("Removed".. Part.Name)
break
end
if Part.Shape == Enum.PartType.Block then
game.Workspace.Terrain:FillBlock(Part.CFrame, Part.Size, Enum.Material.Mud)
elseif Part.Shape == Enum.PartType.Cylinder then
elseif Part.Shape == Enum.PartType.Ball then
game.Workspace.Terrain:FillBall(Part.Position, Part.Size.X/2, Enum.Material.Air)
end
Part:Destroy()
wait()
end
I'm either looking for another scriptinghelpers/DevForum link or an example.
Thanks in advance, Tim

7 comments
Hello Tim! I was on your Roblox profile and you said you are a Christian trying to lead people to Jesus Christ, well, I am also a Christian doing the same thing!
Also, where did you learn scripting so well. What did you do and who did you watch.
@goodlead I'm self tough, mostly used sites like this and the lua library.
What is the lua library?
@goodlead like https://developer.roblox.com/en-us/api-reference
Ohhh, so no youtubers you watched to learn like Alvinblox or TheDevKing?
No, those tutorials are too direct.