Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

is there a way to combine these2 scripts?

Asked by 10 years ago
function onEnter()
    script.Parent.BackgroundTransparency = 0.7
end
script.Parent.MouseEnter:connect(onEnter)
function onLeave()
    script.Parent.BackgroundTransparency = 1
end
script.Parent.MouseLeave:connect(onLeave)

i was wondering if one could combine these scripts to make them cleaner and faster

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

Well, you could use a different connection line. It takes up less space and looks a bit neater.

script.Parent.MouseEnter:connect(function()
    script.Parent.BackgroundTransparency = 0.7
end)

script.Parent.MouseLeave:connect(function()
    script.Parent.BackgroundTransparency = 1
end)
Ad

Answer this question