Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why does my click detector is getting inside my part?

Asked by
Shematics 117
6 years ago

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

Log in to vote
2
Answered by
chomboghai 2044 Moderation Voter Community Moderator
6 years ago

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
Yep it work! thank you! Shematics 117 — 6y
Ad

Answer this question