Issue with tweenservice

Im trying to rotate a part of model while rotating whole model but when tweening part i cant tween model

Code:

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

local Model = script.Parent
local part1 = script.Parent.Part
local part2 = script.Parent.p

function convertToAngles(vector)
	return CFrame.Angles(math.rad(vector.X),math.rad(vector.Y),math.rad(vector.Z))
end

function tweenModel()
	spawn(function()
		Model.TweenValue.Value = Model.PrimaryPart.CFrame
		local end_cframe = Model.PrimaryPart.CFrame * convertToAngles(Vector3.new(0,80,0))
		local Tween = TweenService:Create(Model.TweenValue, info, {Value=end_cframe})

		Tween:Play()

		Model.TweenValue.Changed:Connect(function()
			Model:PivotTo(Model.TweenValue.Value)
		end)
	end)
end

while wait(5) do
	TweenService:Create(part1, info, {CFrame=part1.CFrame*CFrame.Angles(0,0,math.rad(45))}):Play()
	tweenModel()
	wait(5)
	TweenService:Create(part1, info, {CFrame=part1.CFrame*CFrame.Angles(0,0,math.rad(-45))}):Play()
	tweenModel()
end

can someone help me fix this?

If you want what I think, then you should use wield constraints so that moving one part moves all of the model.

but when im using welds then i cant tween welded parts

It looks like the tweens are conflicting as both require changing the CFrame. If you split it to alter Position and Orientation separately it might work.

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