You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear! I have a ScrollingFrame that I am trying to tween to the side when you select a text box, however the script I have does not work.
-
What is the issue? Include screenshots / videos if possible! The script is not working.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub? I have tried using print statements, but those wont print.
Script:
local function hide()
script.Parent.Parent.Parent.AutoFill.Visible = false
end
script.Parent.SelectionGained:Connect(function()
print("opening")
script.Parent.Parent.Parent.AutoFill.Visible = true
script.Parent.Parent.Parent.AutoFill:TweenPosition(
UDim2.new(-1,-5,0.25,0),
Enum.EasingDirection.InOut,
Enum.EasingStyle.Sine,
0.5,
true
)
script.Parent.SelectionLost:Connect(function()
print("closing")
script.Parent.Parent.Parent.AutoFill:TweenPosition(
UDim2.new(0,0,0.25,0),
Enum.EasingDirection.InOut,
Enum.EasingStyle.Sine,
0.5,
true,
hide
)
end)
end)
Explorer:

1 Like
Hi!
You made your first typo in SelectionLost
signal script. When you are using a function, you must put the parentheses at the end of the function you defined. So you should rewrite it as
hide()
The second typo, which is inside the TweenPosition
function, shouldn’t be there. You must have used the function inside the TweenPosition function, so this will cause the script to err. So you should use the hide function outside of the TweenPosition function.
Also, you can use the SelectionLost
signal out of the SelectionGained
signal.
local function hide()
script.Parent.Parent.Parent.AutoFill.Visible = false
end
script.Parent.SelectionGained:Connect(function()
print("opening")
script.Parent.Parent.Parent.AutoFill.Visible = true
script.Parent.Parent.Parent.AutoFill:TweenPosition(
UDim2.new(-1,-5,0.25,0),
Enum.EasingDirection.InOut,
Enum.EasingStyle.Sine,
0.5,
true
)
end)
script.Parent.SelectionLost:Connect(function()
print("closing")
script.Parent.Parent.Parent.AutoFill:TweenPosition(
UDim2.new(0,0,0.25,0),
Enum.EasingDirection.InOut,
Enum.EasingStyle.Sine,
0.5,
true,
)
hide()
end)
I think the hide function should be a parameter of the tween, (callback function) but I will try this. Thanks!
Sorry! I forgot to mention about SelectionGained and SelectionLost events. These events fire when a gamepad selects or deselects the text box. You must use Focused
event when the player selects the text box and FocusLost
when deselects.
Also, you can use the callback function in the TweenPosition function.