0

# Button Tweening issues with mouse leave and mouse enter, help?

Edited 3 months ago

When hovering over a button I want it to move up a couple studs or so and move down when I move my mouse away. I have a working version, but I have to keep my mouse hovering over it the whole time its tweening or else it wont go back down when I leave it. I am unsure what I'm doing wrong, I have override set to true.

Here is my Code:

Settings = script.Parent

Settings.MouseEnter:Connect(function()
print("Mouse Entered")
Settings:TweenPosition(UDim2.new(0.143, 0,0.48, 0, "Out", "Quad", 0.2, true))
end)

Settings.MouseLeave:Connect(function()
print("Mouse Left")
Settings:TweenPosition(UDim2.new(0.143, 0, 0.5, 0, "In", "Quad", 0.2, true))
end)


0

You are forgetting to properly use TweenPosition. You aren't including all of the )'s

Settings = script.Parent

Settings.MouseEnter:Connect(function()
print("Mouse Entered")
Settings:TweenPosition(UDim2.new(0.143, 0,0.48, 0), "Out", "Quad", 0.2, true)
end)

Settings.MouseLeave:Connect(function()
print("Mouse Left")
Settings:TweenPosition(UDim2.new(0.143, 0, 0.5, 0), "In", "Quad", 0.2, true)
end)
-- Any type of value, Vector3, UDim2, CFrame, etc... are all defined within ( and ). You must include these otherwise it tries to pick up incorrect arguements.
--[[ TweenPosition consists of a few different arguments, and you are only technically giving it one long incorrect arguement.
TweenPosition(
EndPosition, -- Where the gui needs to be
EasingDirection, -- The direction in which to ease the GUI to the endPosition
EasingStyle, -- The style in which to ease the GUI to the endPosition
time, -- how long it takes to tween
override, -- Whether the tween will override an in-progress tween
callback -- A function that executes when the tween is finished.
]]
--UDim2.new(1,0,1,0)

0
Thanks so much I have been stuck for so long EmeraldRailYT 8 — 3mo