I’m having a dilemma about which of the two methods of tweening below is more efficient, or if there is no real variation.
I want to tween the rotation of my button when the mouse enters it, and tween it to normal when it leaves. For this, I could create the tweens each time the event is fired:
button.MouseEnter:Connect(function()
TweenService:Create(button, TweenInfo.new(.2), { Rotation = 15 }):Play()
end)
button.MouseLeave:Connect(function()
TweenService:Create(button, TweenInfo.new(.2), { Rotation = 0 }):Play()
end)
Or… I could define the tweens at the start and then simply play them:
local enterTween = TweenService:Create(button, TweenInfo.new(.2), { Rotation = 15 })
local leaveTween = TweenService:Create(button, TweenInfo.new(.2), { Rotation = 0 })
button.MouseEnter:Connect(function()
enterTween:Play()
end)
button.MouseLeave:Connect(function()
leaveTween:Play()
end)
Does anyone have any insight into whether one of these methods is more efficient than the other, or if it’d make no impact regardless of which I choose?
Thanks in advance