I have a function which makes plates dissapear, but once the Model is empty it will give an error, as there are no more plates left, and break the whole script, here's what I have:
local Grass = game.Workspace.Classic.Grass:GetChildren() if #Grass == 0 then -- I'm not sure how to "stop" the rest of the function else -- Plates code
If you want to exit the code, simply use 'return'. You can learn more about return here: http://wiki.roblox.com/index.php?title=Function#Using_Return
This is the code you should use.
local Grass = game.Workspace.Classic.Grass:GetChildren() if #Grass == 0 then return -- Exits this if #Grass is 0 else -- Plates code end
There's another way you could do this to remove a few lines by just checking if grass is not 0.
local Grass = game.Workspace.Classic.Grass:GetChildren() if #Grass ~= 0 then -- If #Grass isn't equal 0 then continue -- Plates code end