so i have a thing called a gametick in my game, basically image it as minecrafts gametick.
Every tick the game processes some info right?
I have a command that lets you change the gametick, but i want it to tansition over to the new tick.
local gameTick = 10
function changeGameTick(newTick)
while gameTick ~= newTick do
if gameTick < newTick then
gameTick = gameTick + 1
elseif gameTick > newTick then
gameTick = gameTick - 1
end
print("Current gameTick: " .. gameTick)
wait(0.1)
end
print("Final gameTick: " .. gameTick)
end
-- Example
changeGameTick(20)
local function tweenNumber(endValue, duration)
local TweenService = game:GetService("TweenService")
local numberValue = Instance.new("NumberValue", game.Workspace)
local tweenInfo = TweenInfo.new(duration or 1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local goal = { Value = endValue }
local tween = TweenService:Create(numberValue, tweenInfo, goal)
tween:Play()
numberValue.Changed:Connect(function(property)
print(numberValue.Value)
end)
tween.Completed:Connect(function()
numberValue:Destroy()
end)
end
tweenNumber(100, 5)