banktoner
(bluric_32bit)
August 29, 2021, 2:12pm
1
I’m new to scripting so i might not know how things work
recently i want to make a Picture Scrolling down when clicked but one problem is how they didn’t tend to work because the error just came
Codes inside:
and this is what happen when i loaded into the game
it won’t do anything, but just stay as there
Do i need to replace something with another new Instance?
2 Likes
StarJ3M
(StarJ3M)
August 29, 2021, 2:15pm
2
Its because your using a image label, use a image button instead!
4 Likes
banktoner
(bluric_32bit)
August 29, 2021, 2:19pm
3
No, however i have one imagebutton as it was linked to the code itself but it wasn’t doing anything
1 Like
StarJ3M
(StarJ3M)
August 29, 2021, 2:19pm
4
can you show me the hierarchy of the GUI?
banktoner
(bluric_32bit)
August 29, 2021, 2:24pm
5
I can’t screenshot more but i remember what i have placed inside ScreenGui
Inside ScreenGui contains
LocalScript (main script that i showed)
One ImageButton named “ShopGUI”
One ImageLabel (used for ImageAnimation test)
also inside ImageButton contains one script which is just only appearance as tween
1 Like
If the Image Button is named “Shop GUI”, in your code you have that referenced as “ShopGUI”, therefore instead of referencing your background variable (which is a Image Label), you should reference the ShopGUI variable,
ShopGUI.MouseButton1Up:Connect(function()
-- Code
end)
the error is self explanatory, you are trying to associate mousebutton1up with an image label, when you should be doing it to a button.
you also complained that you did have it on the button and it did nothing, consider swapping to a MouseButton1Click instead and see if it works AND have it associated with a button and not label or etc.
https://developer.roblox.com/en-us/api-reference/class/ImageButton
banktoner
(bluric_32bit)
August 30, 2021, 1:50am
9
i have tried but this time the error is “Udim2”
here’s what it looks like now
thats an error with your code but is proof that the mousebutton1click works.
I believe you forgot the comma after the udim2 stuff
UDim2.new(0.208,0,0.132,0),
I’d appreciate if you mark as solution either first post or this one.
1 Like
Use a image button instead. Other errors are not related but the problem is you are using an image label. Use a image button!
Joel_dev1
(RT_Joelle)
August 30, 2021, 6:09am
12
Use this code
local ShopButton = script.Parent.ShopGui
local Background = script.Parent.Background
ShopButton.MouseButton1Click:Connect(function()
Background:TweenPosition(
UDim2.fromScale(0.208,0.132),
"Out",
"Quint",
1,
false
)
end)
banktoner
(bluric_32bit)
August 30, 2021, 8:37am
13
This one seems to work now
thank you for telling me! I’ll try to remember with this one