local TweenService = game:GetService(“TweenService”)
local sphere = workspace:WaitForChild(“Sphere”)
sphere.Anchored = true
– Save original Y
local originalY = sphere.Size.Y
– 2-second delay
task.wait(2)
– Check for SpecialMesh
local mesh = sphere:FindFirstChildWhichIsA(“SpecialMesh”)
if mesh then
– Tween mesh scale (best option)
local originalScale = mesh.Scale
local targetScale = Vector3.new(
originalScale.X + 0.5,
originalScale.Y, – keep Y the same
originalScale.Z + 0.5
)
local tweenInfo = TweenInfo.new(1.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local tween = TweenService:Create(mesh, tweenInfo, {Scale = targetScale})
tween:Play()
else
– Tween part size, but fix Y during/after tween
local originalSize = sphere.Size
local targetSize = Vector3.new(
originalSize.X + 0.5,
originalSize.Y, – keep Y the same
originalSize.Z + 0.5
)
local tweenInfo = TweenInfo.new(1.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local tween = TweenService:Create(sphere, tweenInfo, {Size = targetSize})
tween:Play()
-- Force Y to stay constant while tweening (just in case it tries to stretch)
tween:GetPropertyChangedSignal("PlaybackState"):Connect(function()
sphere.Size = Vector3.new(sphere.Size.X, originalY, sphere.Size.Z)
end)
tween.Completed:Connect(function()
-- Snap Y back exactly
sphere.Size = Vector3.new(sphere.Size.X, originalY, sphere.Size.Z)
end)
end
i dont want the Y to change im using a normal sphere part
local TweenService = game:GetService("TweenService")
local sphere = workspace:WaitForChild("Sphere")
sphere.Anchored = true
-- Save original Y
local originalY = sphere.Size.Y
-- 2-second delay
task.wait(2)
-- Check for SpecialMesh
local mesh = sphere:FindFirstChildWhichIsA("SpecialMesh")
if mesh then
-- Tween mesh scale (best option)
local originalScale = mesh.Scale
local targetScale = Vector3.new(
originalScale.X + 0.5,
originalScale.Y, -- keep Y the same
originalScale.Z + 0.5
)
local tweenInfo = TweenInfo.new(1.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local tween = TweenService:Create(mesh, tweenInfo, {Scale = targetScale})
tween:Play()
else
-- Tween part size, but fix Y during/after tween
local originalSize = sphere.Size
local targetSize = Vector3.new(
originalSize.X + 0.5,
originalSize.Y, -- keep Y the same
originalSize.Z + 0.5
)
local tweenInfo = TweenInfo.new(1.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local tween = TweenService:Create(sphere, tweenInfo, {Size = targetSize})
tween:Play()
-- Force Y to stay constant while tweening (just in case it tries to stretch)
tween:GetPropertyChangedSignal("PlaybackState"):Connect(function()
sphere.Size = Vector3.new(sphere.Size.X, originalY, sphere.Size.Z)
end)
tween.Completed:Connect(function()
-- Snap Y back exactly
sphere.Size = Vector3.new(sphere.Size.X, originalY, sphere.Size.Z)
end)
end