I am trying to tween my model scale by + 5 in a span of 15 seconds. Not quite sure how I would do this.
tweenservice:Create(player.Character,TweenInfo.new(growthTime), {Scale = player.Character:GetScale() + .5})
I am trying to tween my model scale by + 5 in a span of 15 seconds. Not quite sure how I would do this.
tweenservice:Create(player.Character,TweenInfo.new(growthTime), {Scale = player.Character:GetScale() + .5})
local elapsed = 0
local duration = 15
local currentScale = 0
local targetScale = currentScale + 5
local connection
function lerp(start, goal, alpha)
return start + (goal - start) * alpha
end
connection = game["Run Service"].Heartbeat:Connect(function(dt)
elapsed += dt
local value = game.TweenService:GetValue(math.min(elapsed / duration, 1), Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
workspace.Model:ScaleTo(lerp(currentScale, targetScale, value))
if elapsed >= duration then
connection:Disconnect()
end
end)