How do i tween a model?

hello everyone, im creating a package arrival for my game, but idk how to tween the package
inside the house, but ok i can weld all the model but the lids of the box need to tween!

serverMain:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")

local config = require(script.Config)

local Events = ReplicatedStorage.Events
local House = workspace.House

Events.BuyItem.OnServerEvent:Connect(function(Player,ModelName)
	local ExistingModel = ReplicatedStorage.Models:FindFirstChild(ModelName)
	
	if ExistingModel then
		ReplicatedStorage.BuyedItems:FindFirstChild(ModelName).Value = "Buyed"
		ReplicatedStorage["BuyedItem?"].Value = true
		wait(6)
		local Box = ReplicatedStorage.Box:Clone()
		local prompt = workspace.House.Doors.EntranceDoor.Knob.Attachment.Prompt
		prompt.Enabled = true
		Box.Name = ModelName
		Box.Parent = workspace.Boxes
		Box:PivotTo(House.PackageTween.StartCFrame.CFrame)
		repeat until prompt.Triggered:Wait()
		prompt.Enabled = false
		wait(0.5)
		wait(1)
	end
end)

for i, model in pairs(ReplicatedStorage.Models:GetChildren()) do
	if model:IsA("Model") then
		local modelValue = Instance.new("StringValue")
		modelValue.Name = model.Name
		modelValue.Value = "Nil"
		modelValue.Parent = ReplicatedStorage.BuyedItems
		
		local Price = Instance.new("NumberValue")
		Price.Name = "Price"
		Price.Value = config[model.Name].Price
		Price.Parent = modelValue
		
		if config[model.Name].BeforeBuy then
			local BeforeBuy = Instance.new("StringValue")
			BeforeBuy.Name = "BeforeBuy"
			BeforeBuy.Value = config[model.Name].BeforeBuy
			BeforeBuy.Parent = modelValue
		end
	end
end

BoxScript:

local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local BuildingModule = require(ReplicatedStorage.Modules.BuildingModule)

local box = script.Parent
local lid1 = box.Tween1
local lid2 = box.Tween2
local bottom = box.Bottom
local PromptAttachment = bottom.Prompt
local ItemAttachment = bottom.Item

function TweenPart(Part, cframe, Time)
	local tween = TweenService:Create(Part, TweenInfo.new(Time),{CFrame = cframe})
	return tween
end

function Open(prompt)
	prompt.Enabled = false
	local tween1 = TweenPart(lid1, box.OpenFolder.Tween1.CFrame, 0.5)
	local tween2 = TweenPart(lid2, box.OpenFolder.Tween2.CFrame, 0.5)
	box.Tape:Destroy()
	tween1:Play()
	tween2:Play()
	wait(1)
	if box.Name == "Garden" then
		workspace.House.Curtain:Destroy()
	end
	BuildingModule.New(box.Name, ItemAttachment)
	wait(3)
	for i, part in pairs(script.Parent:GetChildren()) do
		part:Destroy()
		wait(0.1)
	end
	box:Destroy()
	ReplicatedStorage["BuyedItem?"].Value = false
end

local Prompt = Instance.new("ProximityPrompt")
Prompt.MaxActivationDistance = 5
Prompt.ActionText = ""
Prompt.HoldDuration = 1.5
Prompt.Parent = PromptAttachment

Prompt.Triggered:Connect(function()
	Open(Prompt)
end)

the scripts are server sided if you are wondering

please help.

1 Like

weld all the parts to the main part and tween the main part

also dont tween on the server its bad for performance create an onclientevent to tween and fireallclients instead

i tried but the lids of the box need to tween!

but it even works perfectly fine

A better alternative set the primarypart of the model to a BasePart them tween that. No need for useless welding.

i have a PrimaryPart in the model but idk how to tween the model inside the house and i’ve tried tweening the PrimaryPart

Just tween it normally how you would tween a part…

1 Like

it did’t work…

…the result after the tween is this:

image