of     1   

soutenu
#221001227Monday, July 10, 2017 9:14 PM GMT

function tmp(guiobj) return function() guiobj.BackgroundColor3 = Color3.new(1,1,1) end end obj1.MouseEnter:Connect(tmp(obj1)) obj2.MouseEnter:Connect(tmp(obj2)) obj3.MouseEnter:Connect(tmp(obj3)) ...etc
KnightmareXD
#221001887Monday, July 10, 2017 9:23 PM GMT

I believe you can loop through the GUI objects and call it from there: for index, obj in pairs(objectPaths) do obj.MouseEnter:connect(tmp(obj)) end
soutenu
#221002121Monday, July 10, 2017 9:25 PM GMT

@Knightmare not the connecting part, im mainly concerned with the function
cntkillme
#221002210Monday, July 10, 2017 9:26 PM GMT

Sadly there's not. You can't pass extra arguments to Connect and have it forward to your callback (there's a few reasons I can think of why, but that's not really relevant).
soutenu
#221002358Monday, July 10, 2017 9:28 PM GMT

#### alright thanks, ill keep that in mind
KnightmareXD
#221002451Monday, July 10, 2017 9:29 PM GMT

I'm not sure what you're trying to do. Whenever the mouse hovers over a guiobject, you want to change the background to white? I'm not sure why you're returning anything, and what "efficient" in this case would be.
KnightmareXD
#221002524Monday, July 10, 2017 9:29 PM GMT

Ahh.
soutenu
#221002707Monday, July 10, 2017 9:31 PM GMT

@Knight im asking if that's the most efficient way of writing a function once compared to having something like this, obj1.MouseEnter:Connect(function() --body end) obj2.MouseEnter:Connect(function() --body end)
KnightmareXD
#221002896Monday, July 10, 2017 9:33 PM GMT

If they have the same body then you could loop through the objects and call it from there. I wasn't sure about the connection, so I'll regard ### in that case.
Lucas_Lua
#221002909Monday, July 10, 2017 9:33 PM GMT

There's no way to make this more efficient, but you can pass anonymous functions instead: for _, obj in pairs(LIST_OF_OBJECTS) do obj.MouseEnter:connect(function() obj.BackgroundColor3 = Color3.new(1, 1, 1) end); end This is what you are doing anyway, except this frees up a name in the namespace. Not much of an improvement, but it is more readable.
soutenu
#221002937Monday, July 10, 2017 9:34 PM GMT

this is nice since i can just edit the body of the function returned rather than editing every single body if i want to make a change to the function
soutenu
#221003038Monday, July 10, 2017 9:35 PM GMT

not all of my items in the list would work since some of them i don't want to react to MoverHover
soutenu
#221003065Monday, July 10, 2017 9:35 PM GMT

Enter***
KnightmareXD
#221003172Monday, July 10, 2017 9:36 PM GMT

Then set a condition for the objects you do want to trigger.
soutenu
#221003209Monday, July 10, 2017 9:36 PM GMT

so i feel like what im doing would be better and shorter than iterating through an array and having an ignorelist

    of     1