How do I make a tween curved

I have this crate opening system that gets a random item with random rarity types but i was wondering if there was a way to curve the tween for the items coming out of the crate as it comes out as right now it’s a straight tween that just goes in a v shape.

This is the part that does the tween which is a ServerScript:

function createItem(itemName, spawnCF, particle, crateModel)
	local itemClone = fakeItems[itemName]:Clone()	--fakeItems is a folder in ServerStorage that holds all the fake weapons with proximity prompts to give the player actual tools
	itemClone.CFrame = spawnCF.CFrame
	itemClone.CFrame *= CFrame.Angles(0, math.rad(math.random(0, 360)), 0)
	itemClone.Parent = Workspace.items

	local particleClone = particle:Clone()
	particleClone.CFrame = itemClone.CFrame
	particleClone.Parent = itemClone

	local weldConstraint = Instance.new("WeldConstraint")
	weldConstraint.Part0 = itemClone
	weldConstraint.Part1 = particleClone
	weldConstraint.Parent = itemClone

	local itemSpawnPart = crateModel.itemSpawnPart
	local left = itemSpawnPart.left
	local mid = itemSpawnPart.mid
	local right = itemSpawnPart.right

	task.delay(0.5, function()
		if left.Value and not mid.Value and not right.Value then
			left.Value = false
			mid.Value = true
			right.Value = false

			TweenService:Create(itemClone, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Position = crateModel.leftMid.Position}):Play()
			TweenService:Create(particleClone, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Position = crateModel.leftMid.Position}):Play()

			task.delay(0.5, function()
				TweenService:Create(itemClone, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Position = crateModel.leftEnd.Position}):Play()
				TweenService:Create(particleClone, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Position = crateModel.leftEnd.Position}):Play()
			end)
		elseif not left.Value and mid.Value and not right.Value then
			left.Value = false
			mid.Value = false
			right.Value = true

			TweenService:Create(itemClone, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Position = crateModel.middleMid.Position}):Play()
			TweenService:Create(particleClone, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Position = crateModel.middleMid.Position}):Play()
			
			task.delay(0.5, function()
				TweenService:Create(itemClone, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Position = crateModel.middleEnd.Position}):Play()
				TweenService:Create(particleClone, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Position = crateModel.middleEnd.Position}):Play()
			end)
		elseif not left.Value and not mid.Value and right.Value then
			left.Value = true
			mid.Value = false
			right.Value = false

			TweenService:Create(itemClone, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Position = crateModel.rightMid.Position}):Play()
			TweenService:Create(particleClone, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Position = crateModel.rightMid.Position}):Play()
			
			task.delay(0.5, function()
				TweenService:Create(itemClone, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Position = crateModel.rightEnd.Position}):Play()
				TweenService:Create(particleClone, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Position = crateModel.rightEnd.Position}):Play()
			end)
		end
		
		itemClone.ProximityPrompt.Enabled = true
	end)
end
1 Like

I think what you are looking for is Bezier Curves.
You can take a look here:

2 Likes

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