Help with giving GUI's animations

Hello devforum, I am trying to give my GUI an Animation. For some reason it does not notice when the mouse enters, is there some issue in the script? Help is much appreciated!

local TweenService = game:GetService("TweenService")

local TweenGUI = script.Parent

------------------------------------------------------------------------------------------------------------------------------------
-- Script Hover Entered

local goalHoverEntered = {
	ImageColor3 = Color3.new(0.603922, 0.509804, 0.905882)
}

local tweenInfoHoverEntered = TweenInfo.new(
	1,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

local HoverEnteredTween = TweenService:Create(TweenGUI, goalHoverEntered, tweenInfoHoverEntered)

script.Parent.MouseEnter:Connect(function()
	print("Mouse Enter")
end)

------------------------------------------------------------------------------------------------------------------------------------
-- Script Hover Left

local goalHoverLeft = {
	ImageColor3 = Color3.new(0.603922, 0.509804, 0.905882)
}

local tweenInfoHoverLeft = TweenInfo.new(
	1,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

local HoverLeftTween = TweenService:Create(TweenGUI, goalHoverLeft, tweenInfoHoverLeft)

script.Parent.MouseLeave:Connect(function()
	HoverLeftTween:Play()
end)

you had to put goal and tween info in the correct order
example: from local HoverLeftTween = TweenService:Create(TweenGUI, goalHoverLeft, tweenInfoHoverLeft) to local HoverLeftTween = TweenService:Create(TweenGUI, tweenInfoHoverLeft, goalHoverLeft)

local TweenService = game:GetService("TweenService")

local TweenGUI = script.Parent

------------------------------------------------------------------------------------------------------------------------------------
-- Script Hover Entered

local goalHoverEntered = {
	ImageColor3 = Color3.new(0.603922, 0.509804, 0.905882)
}

local tweenInfoHoverEntered = TweenInfo.new(
	1,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

local HoverEnteredTween = TweenService:Create(TweenGUI, tweenInfoHoverEntered, goalHoverEntered)

script.Parent.MouseEnter:Connect(function()
	print("Mouse Enter")
end)

------------------------------------------------------------------------------------------------------------------------------------
-- Script Hover Left

local goalHoverLeft = {
	ImageColor3 = Color3.new(0.603922, 0.509804, 0.905882)
}

local tweenInfoHoverLeft = TweenInfo.new(
	1,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

local HoverLeftTween = TweenService:Create(TweenGUI, tweenInfoHoverLeft, goalHoverLeft)

script.Parent.MouseLeave:Connect(function()
	HoverLeftTween:Play()
end)
1 Like

You are a genius, i never noticed! Thanks!