Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does my click detector is getting inside my part?

Hi, ive made a script that is used for a tycoon, its a manual dropper script wich is used with a click detector, so when the player click the button a "drop" goes out of the dropper

Everythings work fine, the only things is that when the part drop, there is another click detector inside that part idk if you guys understand what im saying.

Here is the script


function OnClicked()
	wait()
		local value = Instance.new("Part")
value.Position = script.Parent.Parent.fake.Position
value.Anchored = false
value.BrickColor = BrickColor.Random()
value.Parent = script.Parent
value.Size = Vector3.new(1, 1, 1)
value.Name = "Cube"
value.Material = Enum.Material.Neon
value.Shape = "Ball"
end
script.Parent.ClickDetector.MouseClick:Connect(OnClicked)
    

1 answer

✓ Accepted answer

I don't think there is another click detector. It's because you are parenting it to script.Parent, which also contains a click detector, so that will activate upon anything inside the script.Parent.

You could either:

  1. Move the click detector to be in the exact part that you can click and have no other children in that part.
  2. Move the new parts to a different location without the click detector.

Hope this helps! :)

1 comment

1

Yep it work! thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.