Would I be able to do:
a = Torso b = game.workspace.a
Or:
a = "Torso" b = game.workspace[a]
Would either of those try to find A part called torso (wanted) in the workspace or will they just look for a part called a (unwanted)
This is similar to my ultimate aim
Function Check (a, b) c = ""..a d = ""..b if game.workspace[c] ~= nil then print 'Exists: c' if game.workspace[d] ~= nil then print 'Exists: d' end Check(Part, Block)
You can define parts using variables. I always use:
a = game.Workspace:FindFirstChild("PartName")
But the 2nd way you've done it will work (I'm not sure about the first), there are loads of ways of defining a part in a place. But your current function will not work, you have a capital F for function. That wont work, then you have the thing calling the function, this will not work because you have not defined what part and block are, you don't even need them for this. Another thing that's pointless if redefining what a and b are using c. For both of the if statements you forgot to put an end but on the second if statement you are saying 'if game.Workspace.game.Workspace["Torso"] then' and that will return an error. Do the function something like this:
a = "Torso" -- Defines the name of the part. Make sure there IS a part called Torso spelled exactly as you defined it. function check() if game.Workspace:FindFirstChild(a) then -- Looks for a thing named what you defined in workspace. print(a..' Exists') -- Prints the part name then exists. else -- If it's not there then. print(a..' Doesn\'t Exist') -- Prints the part name then doesn't exist. end -- End the if statement and else statement. end -- End the function. check() -- Calls the function to run.
Hope this helps and works for you, if it does please vote up and accept answer!
~ Aaron