ClickDetector Script Not Working

You can write your topic however you want, but you need to answer these questions:
What I’m trying to do, is make a part’s parent the Workspace when a button is clicked with a ClickDetector. The part is not appearing in Workspace, and is still in lighting when someone clicks. I put position in the script, aswell. I’ve tried to add anchored, position, and transparency statements, and the block doesn’t appear. I also added print statements, and both of them work and appear in the output.

Here’s the script:

local Map = game.Lighting.TestPart
local ClickDetector = game.Workspace.Part.ClickDetector

ClickDetector.MouseClick:Connect(function(PlayerWhoClicked)
	print("Clicked")
	Map.Parent = game.Lighting
	Map.Transparency = 0
	Map.Position = Vector3.new(6.66, 0.5, -7.86)
	Map.Anchored = true
	print("Part in workspace")
end)
1 Like

Your map is in Lighting.
If you want it in Workspace then make it game.Lighting to game.Workspace.

OMG, I didn’t see that stupid error, thanks.

No problem! I am glad to help.

1 Like