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

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

Asked by 3 years ago
Edited 3 years 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.

Video Example: https://www.youtube.com/watch?v=a2k2n5sDpS8&ab_channel=JustEmerald

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)

1 answer

Log in to vote
0
Answered by 3 years ago

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 — 3y
Ad

Answer this question