Jump to content

Guessing a number?


Tekken

Recommended Posts

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

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 by StormFighter
Link to comment

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...