#Help with rotating a welded model

1 messages · Page 1 of 1 (latest)

coral vine
#

I have an unanchored and fully welded model that I want to spin (like a display spin). The problem is that when I use part.PrimaryPart.Orientation, the primary part rotates but all other parts don't rotate with it

local pet = script.Parent
while true do
    wait(0.05)
    pet.PrimaryPart.Orientation += Vector3.new(0,5,0)
end
hasty plaza
#
  • wait() is bad, use task.wait() instead
#
  • here using RunService.Heartbeat is better because you can use delta time to make the model spin at a constant rate regardless of lag
cloud valley
hasty plaza
#
  • you have to set the cframe for welds to work
#

if its something like a spinning platform and you want players that stand on it to rotate with it, you have to use physics

coral vine
hasty plaza
#

alr

cloud valley
coral vine
#

pet.PrimaryPart.CFrame = CFrame.new(pet.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(0,5,0)) this errors. what's the right way to do it?

hasty plaza
#
local pet = script.Parent
game:GetService("RunService").Heartbeat:Connect(function(dt)
  pet.PrimaryPart.CFrame *= CFrame.Angles(0, math.rad(100 * dt), 0)
end)
#
local pet = script.Parent
game:GetService("RunService").Heartbeat:Connect(function(dt)
  pet.PrimaryPart.CFrame *= CFrame.Angles(0, math.rad(100 * dt), 0)
end)
#

do i have to put a red circle around it

coral vine
#

same problem. head moves(primary part) and the rest isn't moving

hasty plaza
#

are you sure it's all welded

coral vine
#

yes

hasty plaza
#

and only the primary part is anchored

coral vine
#

the primary part isn't anchorede

noble wasp
#

Can't u pivot it

coral vine
#

nothing is anchored it's in a viewport frame

hasty plaza
#
local pet = script.Parent
game:GetService("RunService").Heartbeat:Connect(function(dt)
  pet:PivotTo(pet:GetPivot() * math.rad(100*dt))
end)
#

would it not fall?

#

also yeah in that case just pivot it

#

i don't think welds work in a viewportframe

coral vine
#

:3: invalid argument #2 (Vector3 expected, got number)

coral vine
#
local pet = script.Parent
game:GetService("RunService").Heartbeat:Connect(function(dt)
    pet:PivotTo(pet:GetPivot() * math.rad(100*dt))
end)
hasty plaza
#

???

noble wasp
#

I don't thinks it's how rotate cframe

hasty plaza
#

oh

#

wtf am i doing

#
local pet = script.Parent
game:GetService("RunService").Heartbeat:Connect(function(dt)
  pet:PivotTo(pet:GetPivot() * CFrame.Angles(0, math.rad(100 * dt), 0))
end)