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

How do I make a part clicker?

I want to make a game, like an easter egg hunt, where you have to find all the eggs, and when you click an egg, the counter GUI on the side goes up, but I don't know how. I'm really new to scripting and terrible at it, so if someone could help it would be much appreciated. Thanks!

1 comment

0

Ok, Heres my Answer Below, RektwayYTB..

1 answer

Good Morning / Evening!

I heard thats you need some help with click parts, correct?

Heres some help and scripting:

  1. Insert a ClickDetector in Your Egg

  2. Edit the Distance (Default is 32)

  3. Insert in the ClickDetector a Basic Script, Which fired when Clickdetector Mouse Clicking:

Clicking Script: Inside ClickDetector, The ClickDetector is Inside the Egg

script.Parent.MouseClick:Connect(function()
       local Egg = script.Parent.Parent
       local Counter = game.StarterGui.ScreenGui.TextLabel
       local Target_Position = Vector3.new(R) -- Replace R with the Position you Want
       Egg.CFrame = CFrame.new(Target_Position)
       Counter.Text = Counter.Text + 1
end)

Next Step!

  1. Insert a ScreenGUI in StarterGUI

  2. Insert a TextLabel in ScreenGUI

  3. Customize the TextLabel if You Want

  4. Insert a LocalScript in TextLabel

Things to Understand:

Why LocalScript and Not Basic Script?

Cause The LocalScript Runs on The Client, Which is Playing Your Game And if in Basic Script, then When someone finds a egg, It gives it to everyone, and thats a bug.

LocalScript in TextLabel:

script.Parent.Changed:Connect(function()
       script.Parent.Text = "Eggs Found: "..Script.Parent.Text
end)

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