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!
Good Morning / Evening!
I heard thats you need some help with click parts, correct?
Heres some help and scripting:
Insert a ClickDetector in Your Egg
Edit the Distance (Default is 32)
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!
Insert a ScreenGUI in StarterGUI
Insert a TextLabel in ScreenGUI
Customize the TextLabel if You Want
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)
Closed as Not Constructive by Soban06, RazzyPlayz, and imKirda
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?