Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What's the simplest way to rotate a model 90 degrees?

Assuming the parts in the model is unanchored and welded together, would I use SetPrimaryPartCFrame()? Attempting to make a flippable table with animation. Preferable on a key down function, using magnitude to check if your next to it Here's what I got so far..


mouse=game.Players.LocalPlayer:GetMouse()
function checkTableDistance(torso,table,dist)
for i,v in pairs(table) do
if (v.Position-torso.Position).magnitude<=dist then
return true
end
end.
end

function findNearestTable(torso,table)
mags={}
for i=1,#table do
table.insert(mags,#mags+1,(#table[i].Position-torso.Position).magnitude)
end
return math.min(mags)
end

while wait(0.5) do
if checkTableDistance(game.Players.LocalPLayer.Character.Torso ,Workspace.table:GetChildren()) then
--gui
end

mouse.KeyDown:connect(function(key)
if key=="e" and checkTableDistance() then
table=findNearestTable(game.Players.LocalPlayer.Character.Torso,Workspace.table:GetChildren())
--table flippy
end
end)

4 comments

0

What do you mean?

0

CFrames Are The Simplest Way to rotate

0

what would I add above to achieve the 90 degree flip?

0

CFrame * CFrame.Angles(math.rad(x), math.rad(y), math.rad(z))

1 answer

✓ Accepted answer

Set a primary part to the model, use SetPrimaryPartCFrame and GetPrimaryPartCFrame,



Model:SetPrimaryPartCFrame(Model:GetPrimaryPartCFrame() * CFrame.Angles(--[[your angle X,Y,Z]]))

This discussion is preserved as it was. New answers, comments, and votes are closed.