Tekken Posted July 5, 2017 Share Posted July 5, 2017 Hello, So I have a table like this: local myTable = {thing1={},thing2={}}; for i = 1, 20 do myTable.thing2[i] = "something"..i; end Those tables stores GUI images and I want to do something like this: addEventHandler("onClientMouseEnter", root, function() if (source == myTable.thing2[?]) then guiSetAlpha(myTable.thing2[?], 1); end end); My question is, how do I know what "thing2" my mouse enters? is there a way to find out? Cause I don't want long functions with tones of if this do that statements. Thank you. Link to comment
WorthlessCynomys Posted July 5, 2017 Share Posted July 5, 2017 (edited) source is the gui your mouse enters. If you want it to become visible when you hover over it, don't do any if checks just use the source argument. You can filter it, to the thing2, which is like: for _, gui in ipairs(myTable.thing2) do if (source == gui) then --Do something end end Edited July 5, 2017 by StormFighter Link to comment
Tekken Posted July 5, 2017 Author Share Posted July 5, 2017 Yeah thanks it worked. But I already tried this and didn't work, not because I didn't had the right script but because I also have some text over the image and every time I hover the text the alpha changes. :\ Link to comment
WorthlessCynomys Posted July 5, 2017 Share Posted July 5, 2017 Well... make a new table for texts and then it wont matter 1 Link to comment
Tekken Posted July 5, 2017 Author Share Posted July 5, 2017 Yup, is just that I just figured that out. Thank's anyway without you would've take me much more time to figure it out. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now