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

This clickdetector script doesn't work and the output doesn't print anything?

Hey guys, I'm trying to make my own egg hunt game, and when you click on the eggs, a frame appears (that is my first part of the game), but this script doesn't error in the output (the output doesn't print anything about this) and the frame doesn't appear when I try clicking on the eggs.

Here is my script:

-- egg folder

local eggfolder = script.Parent

-- oof egg variables

local eggofbloxxed = eggfolder.EggofBloxxed

local oof_frame = game.StarterGui.EggGuis.OofEggGui.Frame

local oofclickdetector = script.Parent.EggofBloxxed.ClickDetector1

-- normal egg variables

local normalclickdetector = script.Parent.NormalEgg.ClickDetector2

local normal_egg = eggfolder.NormalEgg

local normalframe = game.StarterGui.EggGuis.NormalEggGui.Frame

-- normal egg clickdetector script

eggfolder.eggofbloxxed.oofclickdetector.MouseClick:Connect(function()
	oof_frame:TweenPosition(UDim2.new(0.5, 0,0.353, 0),2.9)
end)

-- oof egg clickdetector script

eggfolder.normal_egg.normalclickdetector.MouseClick:Connect(function()
	normalframe:TweenPosition(UDim2.new(0.5, 0,0.353, 0),2.9)
end)

Anyone know how to solve this issue?

Thanks!

2 answers

✓ Accepted answer

Try this, you can put this in a serverscript; if it doesn't work then check your GUI/Frame position, I tested it myself.

https://prnt.sc/s3lf8q

https://prnt.sc/s3lfl3

-- [ Variables ] --
local EggStorage = script.Parent

-- Oof Egg Variables --
local EOB = EggStorage:WaitForChild("EggofBloxxed")
local EOBClickdetector = EOB:WaitForChild("ClickDetector1")

-- Normal Egg Variables --
local NE = EggStorage:WaitForChild("NormalEgg")
local NEClickDetector = NE:WaitForChild("ClickDetector2")

-- [ Events ] --

-- EggOfBloxxed --
EOBClickdetector.MouseClick:Connect(function(Player)
	warn(Player.Name.." has found the EggOfBloxxed!")
	local PlayerGui = Player:WaitForChild("PlayerGui")
	local EggGuis = PlayerGui:WaitForChild("EggGuis")
	local SpecificEggGui = EggGuis:WaitForChild("OofEggGui")
	local SpecificEggFrame = SpecificEggGui:WaitForChild("Frame")
	SpecificEggFrame:TweenPosition(UDim2.new(0.5, 0, 0.353, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.75)
end)

-- Normal Egg --
NEClickDetector.MouseClick:Connect(function(Player)
	warn(Player.Name.." has found the Normal Egg!")
	local PlayerGui = Player:WaitForChild("PlayerGui")
	local EggGuis = PlayerGui:WaitForChild("EggGuis")
	local SpecificEggGui = EggGuis:WaitForChild("NormalEggGui")
	local SpecificEggFrame = SpecificEggGui:WaitForChild("Frame")
	SpecificEggFrame:TweenPosition(UDim2.new(0.5, 0, 0.353, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.75)
end)

2 comments

0

Thanks! It actually worked!

0

Your welcome.

Try this

-- egg folder

local eggfolder = script.Parent

-- oof egg variables

local eggofbloxxed = eggfolder.EggofBloxxed

local oof_frame = game.StarterGui.EggGuis.OofEggGui.Frame

local oofclickdetector = script.Parent.EggofBloxxed.ClickDetector1

-- normal egg variables

local normalclickdetector = script.Parent.NormalEgg.ClickDetector2

local normal_egg = eggfolder.NormalEgg

local normalframe = game.StarterGui.EggGuis.NormalEggGui.Frame

-- normal egg clickdetector script

eggfolder.eggofbloxxed.oofclickdetector.MouseButton1Click:Connect(function()
    oof_frame:TweenPosition(UDim2.new(0.5, 0,0.353, 0),2.9)
end)

-- oof egg clickdetector script

eggfolder.normal_egg.normalclickdetector.MouseButton1Click:Connect(function()
    normalframe:TweenPosition(UDim2.new(0.5, 0,0.353, 0),2.9)
end)

3 comments

0

ClickDetectors don't use MouseButton1Click, but ImageButtons and TextButtons do.

0

Yeah, it doesn't work. ;(

0

Me bad, sorry

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