I’m just using a LocalScript to make all of my buttons interactive and feel nicer,
but I can’t seem to fix the scaling issue. Whenever the tweens are triggered, the buttons slowly tween size into nothing.
local players = game:GetService("Players")
local tweenservice = game:GetService("TweenService")
local replicatedstorage = game:GetService("ReplicatedStorage")
local localplayer = players.LocalPlayer
local char = localplayer.Character or localplayer.CharacterAdded:Wait()
local buttondowncolor = Color3.fromRGB(177,177,177)
local buttonupcolor = Color3.fromRGB(255,255,255)
function buttonize(button: ImageButton)
button.AutoButtonColor = false
button.ImageColor3 = buttonupcolor
local tweensize1 = tweenservice:Create(button, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {Size = UDim2.new(button.Size.X.Scale/2,button.Size.Y.Scale/2)})
local tweensize2 = tweenservice:Create(button, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {Size = UDim2.new(button.Size.X.Scale/2,button.Size.Y.Scale/2)})
button.MouseEnter:Connect(function()
button.ImageColor3 = buttondowncolor
tweensize1:Play()
print("MouseEnter")
end)
button.MouseLeave:Connect(function()
button.ImageColor3 = buttonupcolor
tweensize2:Play()
print("MouseLeave")
end)
button.MouseButton1Down:Connect(function()
button.ImageColor3 = buttondowncolor
end)
button.MouseButton1Up:Connect(function()
button.ImageColor3 = buttonupcolor
end)
end
for _, button in pairs(script.Parent:GetDescendants()) do
if button:IsA("ImageButton") then
buttonize(button)
end
end
This should be simple, but I can’t find the solution.