Parts not being located by the Local Script

So I am making a Local Script where you have to walk up to parts with a Tool and then the part will go invisible and with debugging prints it shows that the part is not detected in the workspace when it literally is. I believe my coding is correct e.g used

local part = workspace.WaitForChild:(“Part”)

to define the part and use
Oh also there is no errors so I don’t think the script is wrong I am just assuming it is an issue on Roblox’s end!
Please help me!

The : is meant to be placed immediately after workspace instead of after WaitForChild.

Updating it to the following should allow it to work as intended:

local part = workspace:WaitForChild("Part")

workspace:WaitForChild(“Part”) this is the correct way to use it

Oh apologies, no I just misspelt (in the script it is the way you have said) - if that was the case I would have gotten a error output

Thank you though

1 Like

Oh in that case, are any warnings appearing in the Output? If that line of code is running and it doesn’t find the Part after 5 seconds, it should warn that an “Infinite yield is possible”. If that warning never appears in the Output, it’s likely that the LocalScript isn’t running that line of code.

Where is the LocalScript placed in the game? The code of LocalScripts will only run under certain circumstances / when descendants of specific containers, so there’s a chance it might be placed somewhere where its code isn’t being run.