Hey, so my script places a GUI on a wall that someone has placed down once clicked on in case they would like to destroy it or they've misplaced it. Everything goes to plan and works fine when i'm playing in studio, but what it comes to playing online, the console says the ClickDetector does not exist in the part?

enabled = 1

script.Parent.ClickDetector.MouseClick:connect(function(playerWhoClicked)
	if enabled == 1 then
	if script.Parent.Parent.Parent.Parent.Name == (playerWhoClicked.Name.."'s House") then
		local Gui = game.Lighting.DestroyBlock
		Gui:Clone().Parent=script.Parent
		wait(0.5)
		enabled = 0
	end
	else if enabled == 0 then
		script.Parent.DestroyBlock:Destroy()
		wait(0.5)
		enabled = 1
		end
	end 
end)

2 comments

0

Make sure your hierarchy is correct. Perhaps you put the script inside the ClickDetector?

0

Try :WaitForChild() and make sure the Archivable property is set to true