Would it be possible to use Model:PivotTo() as a tween?

I know Methods such as RenderStepped or Tween could be used but thats not the point of this discussion.

If possible, how would it be done?

question also goes for Model:ScaleTo()

heres the documentation: Model | Documentation - Roblox Creator Hub

1 Like

You can make a CFrame value and/or Vector3 value, tween it’s value. Then use model:MoveTo(vectorValue) or model:PivotTo(CFrameValue).
(Using changed or GetPropertyChangedSignal)

It should work perfectly fine like a tween.

I don’t understand how you mean you don’t want to use Tween (TweenService).

I think that’s the only way.
You can put a CFrameValue inside it.
And also set the primary part to any part (weld recommended)

You can use Tween for model, like this (replace “mod” with the model):
NOTE: THIS SCRIPT ISN’T MINE. IT COMES FROM THIS:

here’s the script (this is only the module function, after, you can use it):

local tweenService = game:GetService("TweenService")
local info = TweenInfo.new()

local function tweenModel(model, CF)
	local CFrameValue = Instance.new("CFrameValue")
	CFrameValue.Value = model:GetPrimaryPartCFrame()

	CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
		model:SetPrimaryPartCFrame(CFrameValue.Value)
	end)
	
	local tween = tweenService:Create(CFrameValue, info, {Value = CF})
	tween:Play()
	
	tween.Completed:Connect(function()
		CFrameValue:Destroy()
	end)
end

Then, after, you can do this:

local mod = *your model*

local CFrame_Value = *Cframe Value*

tweenModel(mod, CFrame_Value)

Specificing what @narutoiiia said but in Script

It seems like tweening a value will not be possible because it is impossible.

Only tweens on Objects are possible

I am not sure if there is a way to tween PivotTo, but you could make a primary part in your model and weld everything to it, then unanchored everything but the primarypart, and then tween the primary part, which will tween the whole model.

that also means using :ScaleTo is off limits.

Ideally there could be one value for both ScaleTo and PivotTo

1 Like

That is 100% percent possible.

Lerp was the solution.

here is the code:

local function lerpGeneral(Object,TargetSize,Time)
		
	local Ogscale = Object:GetScale()
	local StartTime = os.clock()
	local ScaleDiff = TargetSize-Ogscale

	local Hb Hb = RunService.Heartbeat:Connect(function()
		local ElapsedTime = os.clock() - StartTime
		local Alpha = ElapsedTime/Time

		if Alpha >= 1 then
			Hb:Disconnect()
			Object:ScaleTo(TargetSize)
		else
			local ScaleN = Ogscale + (ScaleDiff * Alpha)

			Object:ScaleTo(ScaleN)
		end
	end)
end

I hope this can help someone in the future

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.