My model doesn’t seem to tween its CFrame. Can anyone help?
Plant = game.ReplicatedStorage.PlantingObjects.WheatSeed:Clone()
Plant.Parent = Soil
local PlantCf = Plant:GetPrimaryPartCFrame()
local SoilCF = CFrame.new(script.Parent.Position.X, script.Parent.Position.Y - 5, script.Parent.Position.Z)
PlantCf = Plant:SetPrimaryPartCFrame(SoilCF)
GrowTime = 10 / Divide
Tween = TweenInfo.new(GrowTime)
SoilCF = Soil.CFrame.Position
local TweenPlant = TweenService:Create(Plant.PrimaryPart.CFrame, Tween, {Position = SoilCF})
print(SoilCF)
TweenPlant:Play()
blokav
(blokav)
October 24, 2020, 8:30pm
#2
Models don’t have any CFrame property that can be tweened. You could tween a CFrameValue and constantly use SetPrimaryPartCFrame to that value, but that’s not really a good idea.
This tutorial might help.
Edit (06/30/2021): Due to the release of the new pivot APIs and the thankful deprecation of SetPrimaryPartCFrame, the legacy method of CFraming is now also appropriate and you do not necessarily need to use this welding method. Do note that the pivot CFrame is different from the PrimaryPart CFrame though, so you will have to account for that when writing your proxy objects.
Edit (05/31/2023): Roblox has an official code sample for model tweening! It’s very lightweight and covers the necessities…
1 Like