how do i tween a weld
char limit
I guess the newer welds don’t have CFrame properties. You can still use an older “Weld” object though. To tween a Weld, just tween the Weld.C1 or Weld.C0.
Edit:
I think the newer way to do this is to have attachments in both models, connect them with a RigidJoint, then tween one of the attachment’s CFrame (which is relative to the part it’s under).
If this is a model set the PrimaryPart and rotate that. Or rotate everything together.
like i said i already tried that and it only rotated the primary part, nothing else
Hmmm, well there is always this, A bit crazy I think …
local TweenService = game:GetService("TweenService")
local tool = script.Parent
local model = tool:WaitForChild("Model")
local targetCFrame = CFrame.Angles(math.rad(90), math.rad(0), math.rad(0))
for _, part in pairs(model:GetDescendants()) do
if part:IsA("BasePart") then
local goal = {}
goal.CFrame = part.CFrame * targetCFrame
local tween = TweenService:Create(part, TweenInfo.new(1), goal)
tween:Play()
end
end
A raw version of PrimaryPart tween
local TweenService = game:GetService("TweenService")
local model = workspace:WaitForChild("Model")
local primaryPart = model.PrimaryPart
local targetCFrame = CFrame.Angles(math.rad(90), math.rad(0), math.rad(0))
local goal = {CFrame = primaryPart.CFrame * targetCFrame}
local tween = TweenService:Create(primaryPart, TweenInfo.new(1), goal)
tween:Play()
tween a cframe value and set up a .Changed function to use model:PivotTo to rotate the model
like
CFrameValue.Changed:Connect(function(Value)
Model:PivotTo(Value)
end)
i feel like thats a little unoptimized
heres what it looks like right now btw: (In this test im moving it, not rotating)
are the parts that are supposed to be attached to moving part welded to it?
yea they are welded to it with WeldContraints
You should try using a rigid constraint then tweening the attachments it’s between if you’re looking to tween it.
Also, here is the more common way to animate tools (using animations instead of Tweens):
- Set a PrimaryPart for your model.
- Put WeldConstraints in every part in your model except for your PrimaryPart.
- Set Part0 to the WeldConstraint’s parent and Part1 to the PrimaryPart.
- Tweening in this way will only work with CFrame, so…
local TweenService = game:GetService("TweenService")
local Model = script.Parent -- Change as needed.
local PrimaryPart = Model.PrimaryPart
local Info = TweenInfo.new(1, Enum.EasingStyle.Linear)
local Goal = {PrimaryPart.CFrame * CFrame.new(0, 5, 0)}
local Tween = TweenService:Create(PrimaryPart, Info, Goal)
Tween:Play()
ive already said this, i tried this exact thing and it didnt work
Is only the PrimaryPart moving? Sorry, I didn’t read every reply here.
When you try what I just suggested, I mean.
yes only the primary part is moving
I definitely had this problem so what I did i mean for my case was create a variable that held a CFrameValue instance and instead i tweened that CFrameValue instance, then in a loop (which i unbinded after the tween was complete) I set the models:PivotTo, to the CFrame Value. This is a little nasty but it gets the job done.
Although tweening your models primary part cframe is the best option here only if every single part is welded towards the primary part
tried this and now the whole tool is moving instead of the one part
local TweenService = game:GetService("TweenService")
local Model = script.Parent -- Change to your model path
local Info = TweenInfo.new(1, Enum.EasingStyle.Linear)
for _, Part in pairs(script.Parent:GetDescendants()) do
if Part:IsA("BasePart") then
spawn(function()
local Tween = TweenService:Create(Part, Info, {CFrame = Part.CFrame * CFrame.Angles(0, 5, 0)})
Tween:Play()
Tween.Completed:Wait()
print("The model has been rotated!")
end)
end
end