Quick question! Right now I'm using an if statement:
if game.Workspace.part ~= nil then
-- Do something
end
If the part doesn't exist, then I'm getting an error because it is looking for the part to check if it is nil. It works in the sense that the code inside won't run unless the part does exist, but I'd rather have fully functional and optimized code.
So that leads me to my question- what should I be using instead?

5 comments
Nice! That works perfect, thank you! I'm accepting your answer for the extra effort in different approaches and more detail. Cheers!
thanks
Um, where does it say game.Workspace is deprecated? It’s the other way around.
its all over fourms and the wiki its easier too but you can still use it
Link where it says this.