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

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

Asked by
LazokkYT 117
4 years ago

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

Log in to vote
0
Answered by
SnowieDev 171
4 years ago

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)
0
Thanks! It actually worked! LazokkYT 117 — 4y
0
Your welcome. SnowieDev 171 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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)
0
ClickDetectors don't use MouseButton1Click, but ImageButtons and TextButtons do. SnowieDev 171 — 4y
0
Yeah, it doesn't work. ;( LazokkYT 117 — 4y
0
Me bad, sorry Shadic1270 136 — 4y

Answer this question