I’ve tried everything, every video and forum post there is to find.
I have a model of a dumbbell with the two part: handle and the dumbell. in the handle is a weld to weld the handle and dumbbell, the handle is the only part that’s anchored and it’s the primary part.
It doesn’t matter what I script sometimes it won’t move or only the dumbbells, never the handle.
I’ve had the same issue before. I use a manual weld rather than weld constraints which works perfect for tweening. Another check to make sure of is that nothing is anchored if it’s a tool or if it’s a normal model then only the primary part is anchored.
I use this plugin to make the manual welds easy to use: https://create.roblox.com/store/asset/148570182/Weld
cframe tweening AFAIK is the only method that will work, do sm like this
-- assume that TweenService reference exists already
local dumbellOrigin = newDumbell.PrimaryPart.CFrame
local dumbellTweenInfo = TweenInfo.new(dumbellMoveDuration)
local dumbellTween = tweenService:Create(newDumbell.Handle, dumbellTweenInfo, {
CFrame = dumbellOrigin + Vector3.new(0, 5, 0)
}) -- if the handle is named Handle then go ahead, otherwise replace Handle in this code
-- for the actual name of the handle
print(newDumbellHandle:FindFirstChildOfClass("Weld")) -- replace newDumbellHandle with something
print(newDumbellHandle:FindFirstChildOfClass("WeldConstraint")) -- also replace
dumbellTween:Play()
-- if the outputs are nil, you definitely forgot to do something
idk what the problem is if this doesnt work, best solution is to just post the view of the dumbell in the explorer and put it here so we can pick apart what went wrong
If you don’t mind the movement being linear, you could move the newDumbell model using the MoveTo method and interpolate between the model’s current position and the target position:
local RunService = game:GetService("RunService")
local function moveDumbell(newDumbell: Model, dumbellMoveDuration: number?)
local dumbellMoveDuration = dumbellMoveDuration or 1 -- This will make the move duration default to 1 second if the second argument isn't provided
local startPosition = newDumbell:GetPivot().Position
local targetPosition = Vector3.new(0, newDumbell.PrimaryPart.Size.Y + 5, 0)
local x = 0
local connection
connection = RunService.Heartbeat:Connect(function(deltaTime: number)
x = math.min(x + (deltaTime / dumbellMoveDuration), 1)
newDumbell:MoveTo(startPosition:Lerp(targetPosition, x))
if x == 1 then
connection:Disconnect()
end
end)
end
Example on how to call the function:
moveDumbell(newDumbell, 4) -- Using 4 as the second argument would result in the dumbell taking 4 seconds to reach the target position