So I created this script so that the frame can fly in but it does not work
Script:
script.Parent.MouseButton1Click:Connect(function()
local GamePassShop = script.Parent.Frame
GamePassShop:TweenPosition(UDim2.new(0.272, 0,0.181, 0), "Out", "Bounce",1,true)
end)
But it does not seem to take the Frame and this is the frame
I tried renaming it but it does not work
2 Likes
Tomasoplo
(Tomasoplo)
November 30, 2021, 3:24pm
2
Try this
local GamePassShop = script.Parent.Parent.Frame
1 Like
Thanks man appreciate the help
1 Like
Thanks but I came across another problem same script but with the closing animation
script.Parent.MouseButton1Click:Connect(function()
local GamePassShop = script.Parent.Parent
GamePassShop:TweenPosition(UDim2.new(0.272, 0,0.181, 0), "Out", "Bounce",1,true)
end)
Tomasoplo
(Tomasoplo)
November 30, 2021, 3:29pm
5
I think you forgot to type .Frame at the end
local GamePassShop = script.Parent.Parent.Frame
Tomasoplo
(Tomasoplo)
November 30, 2021, 3:30pm
6
If you are trying to close the gui, make sure the tween position is different from the first one, so it actually moves the gui somewhere else
Ya I tried that but it tells Frame is not a valid member
Ok so I should change the position value in this line right?
GamePassShop:TweenPosition(UDim2.new(0.272, 0,0.181, 0), "Out", "Bounce",1,true)
Tomasoplo
(Tomasoplo)
November 30, 2021, 3:31pm
9
Is this the same script like the first one?
Tomasoplo
(Tomasoplo)
November 30, 2021, 3:31pm
10
Yeah, change the position there
Tomasoplo
(Tomasoplo)
November 30, 2021, 3:33pm
11
I also suggest to declare the GamePassShop variable at the start of the script, so you don’t have to create a new variable each time you press the button
nope I just added another localscript in the CloseButton
Tomasoplo
(Tomasoplo)
November 30, 2021, 3:34pm
13
Can you show where the close button is located?
Tomasoplo
(Tomasoplo)
November 30, 2021, 3:37pm
15
local GamePassShop = script.Parent.Parent
This should work. Make sure you change the position, because if its same as the first one, it will just stay in one place
Forummer
(Forummer)
December 1, 2021, 6:41am
16
local button = script.Parent
local GamePassShop = script.Parent.Parent:WaitForChild("Frame")
button.MouseButton1Click:Connect(function()
GamePassShop:TweenPosition(UDim2.new(0.272, 0,0.181, 0), "Out", "Bounce", 1, true)
end)
You shouldn’t be redeclaring a constant (a variable of which its stored value, in this case reference to some instance, never changes), this is for the first script (opening button).
Forummer
(Forummer)
December 1, 2021, 6:41am
17
local button = script.Parent
local GamePassShop = script.Parent.Parent
button.MouseButton1Click:Connect(function()
GamePassShop:TweenPosition(UDim2.new(0.272, 0,0.181, 0), "Out", "Bounce", 1, true)
end)
This is for the second script (closing button).
Forummer
(Forummer)
December 1, 2021, 6:42am
18
I presume the local script inside the close button is handling the button itself.