Whenever i attempt to tween vector3 on one axis negatively, for some reason the other 2 axis also tween as well. (See attached video)
Whenever i tween positively this does not happen. Any help appreciated.
local TweenService = game:GetService("TweenService")
local ti = TweenInfo.new(0.15, Enum.EasingStyle.Back, Enum.EasingDirection.Out)
local Goal = {Rotation = Vector3.new(0,120,0)}
local Goal2 = {Rotation = Vector3.new(0,90,0)}
local Goal3 = {Rotation = Vector3.new(0,60,0)}
local ScaleGoal = {Scale = 0.9}
local ScaleGoal2 = {Scale = 1.1}
local ScaleGoal3 = {Scale = 1}
local FrameTrigger = require(game:GetService("ReplicatedStorage"):WaitForChild("Packages"):WaitForChild("FrameTrigger"))
local Buttons = script.Parent:WaitForChild("Frame")
function convertAbsoluteToScale(frame): UDim2
local container = frame.Parent
local containerAbsPos = container.AbsolutePosition
local containerAbsSize = container.AbsoluteSize
local frameAbsPos = frame.AbsolutePosition
local frameRelativePos = frameAbsPos - containerAbsPos
return UDim2.fromScale(frameRelativePos.X / containerAbsSize.X, frameRelativePos.Y / containerAbsSize.Y)
end
local reversable = false
for i,v in Buttons:GetChildren() do
if v:IsA("Frame") then
local Click: TextButton = v:WaitForChild("Click")
local Tween = TweenService:Create(v:WaitForChild("ViewportFrame"):WaitForChild("Part"), ti, Goal)
local Tween2 = TweenService:Create(v:WaitForChild("ViewportFrame"):WaitForChild("Part"), ti, Goal2)
local Tween3 = TweenService:Create(v:WaitForChild("ViewportFrame"):WaitForChild("Part"), ti, Goal3)
local ScaleTween2 = TweenService:Create(v.UIScale, ti, ScaleGoal2)
local ScaleTween = TweenService:Create(v.UIScale, ti, ScaleGoal)
local ScaleTween3 = TweenService:Create(v.UIScale, ti, ScaleGoal3)
local Decal: Decal = v:WaitForChild("ViewportFrame"):WaitForChild("Part"):WaitForChild("Decal")
local CachedColor = Color3.fromRGB(255, 255, 255)
Click.MouseEnter:Connect(function()
if convertAbsoluteToScale(v).X.Scale > 0.45 then
Tween3:Play()
else
Tween:Play()
end
end)
Click.MouseLeave:Connect(function()
Tween2:Play()
ScaleTween3:Play()
Decal.Color3 = CachedColor
end)
Click.MouseButton1Down:Connect(function()
ScaleTween:Play()
FrameTrigger.OpenFrame(v.Name)
Decal.Color3 = Color3.new(Decal.Color3.R/2, Decal.Color3.G/2, Decal.Color3.B/2)
end)
Click.MouseButton1Up:Connect(function()
Decal.Color3 = CachedColor
ScaleTween3:Play()
end)
end
end
External Media