ClickPart not a valid member of Model

I am getting an error that says ‘ClickPart is not a valid member of Model “Workspace.CheckComputer”’
I put this model in workspace and I am continuing to get this error.
image

I have tested this in different games/places I have but it is only giveing me this error in this game. I made no changes when moving it over to the other game and just copied it over directly.

It is giving me an error on the first line below.

game.Workspace.CheckComputer.ClickPart.ClickDetector.MouseClick:Connect(function()
	frame.Visible = true
	frame2.Visible = true
end)

You dont have a clickdetector in there.

image
I put one in there and tested it before. I was still getting this error

Is this in local script? . . . .

1 Like

This is a local script inside of screengui in startergui. When you click the screen on the model, the gui is supposed to show up but I am getting this error insted.

1 Like

Ensure that if you’re running code from a LocalScript, Use :WaitForChild() so we ensure that we await until the specified Instance actually exists before listening to the MouseClick event.

1 Like

Where would I put :WaitForChild() on this line game.Workspace.CheckComputer.ClickPart.ClickDetector.MouseClick:Connect(function()?
Or would I have to wait for the child first then do a separate one for the MouseClick?

It’s recommended to only do :WaitForChild() on the first child. So do it on CheckComputer. If needed, Also do it on ClickPart.

1 Like
workspace:WaitForChild("CheckComputer"):WaitForChild("ClickPart"):WaitForChild("ClickDetector").MouseClick:Connect(function()
	frame.Visible = true
	frame2.Visible = true
end)
1 Like

Insert a script into your ClickDetector and paste this:

script.Parent.MouseClick:Connect(function(plr)
	local plrGui = plr.PlayerGui
	local mainGui = plrGui:WaitForChild("YourGUI")
	local frame = mainGui:WaitForChild("YourFrame")
	local frame2 = mainGui:WaitForChild("YourFrame")
	-- You can add more variable if you want
	
	frame.Visible = true
	frame2.Visible = true
end)
1 Like