Error: KingBunnyHead not a valid member of workspace. Even though it is clearly in the workspace

Hi,
I’ve been getting this error that the part “KingBunnyHead” is not a valid member of the workspace. But it is clearly in the workspace here is a screenshot.


as you can see, I have the “KingBunnyHead” clearly selected in the workspace. Here is where the error occurs:
local function onPartTouched(otherPart)

if otherPart == game.Workspace.KingBunnyHead then

It says the “KingBunnyHead” isn’t in the workspace although it clearly is. Is this a bug or something?

Thanks in advance

1 Like

Maybe try:

if otherPart.Parent.Name == "KingBunnyHead" then

Hope this helps!

1 Like

If this script is a local script you may need to use WaitForChild("KingBunnyHead")

1 Like

Well, it worked. Thanks for the help!

1 Like

No problem, I am glad to help!

1 Like