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

I know you can rotate a part but can you rotate an entire model?

I'm making a city simulator game but the car I'm scripting using the MoveTo method theres a way it has to turn how to make it "Turn" Using rotate? or is it not possible?:

3 answers

Hey, sry about not Commenting, I cant Comment for some Stupid Reason -_- This:

w = script.Parent.Parent.Parent.Doors.Door1 
d = script.Parent.Parent.Parent.Doors.Door2 

for r = 1,30 do 
wait() 
for r,p in pairs(w:GetChildren()) do if (p.className == "Part" or "Wedge" or "Truss" or "Seat") then p.CFrame = p.CFrame - Vector3.new(0,0,-3) end end 
for r,p in pairs(d:GetChildren()) do if (p.className == "Part" or "Wedge" or "Truss" or "Seat") then p.CFrame = p.CFrame - Vector3.new(0,0,3) end end 
end 

Should be:

w = script.Parent.Parent.Parent.Doors.Door1 
d = script.Parent.Parent.Parent.Doors.Door2 

for r = 1,30 do 
wait() 
for r,p in pairs(w:GetChildren()) do if (p.className == "Part" or className == "Wedge" or className == "Truss" or className == "Seat") then p.CFrame = p.CFrame - Vector3.new(0,0,-3) end end 
for r,p in pairs(d:GetChildren()) do if (p.className == "Part" or className == "Wedge" or className == "Truss" or className == "Seat") then p.CFrame = p.CFrame - Vector3.new(0,0,3) end end 
end 

every time className == has to be repeated (from my experience, and again, sry for not Commenting, my Comments are Disabled for some Stupid Reason...

2 comments

0

Use :IsA("BasePart") instead. It's much shorter and robust to changes in the future, and includes CornerWedgePart, SpawnLocation, &c. Also, it's "WedgePart" not "Wedge".

0

I know, I just Commented on TheJeterMan's Answer...

You have to define the models and then get the children then Cframe the children like so:

w = script.Parent.Parent.Parent.Doors.Door1 
d = script.Parent.Parent.Parent.Doors.Door2 

for r = 1,30 do 
wait() 
for r,p in pairs(w:GetChildren()) do if (p.className == "Part" or "Wedge" or "Truss" or "Seat") then p.CFrame = p.CFrame - Vector3.new(0,0,-3) end end 
for r,p in pairs(d:GetChildren()) do if (p.className == "Part" or "Wedge" or "Truss" or "Seat") then p.CFrame = p.CFrame - Vector3.new(0,0,3) end end 
end 

1 comment

0

As KAAK82 points out, your conditions are WRONG. You must explicitly state the condition. The condition will always evaluate to true. Furthermore, USE THE METHOD :IsA("BasePart"), DO NOT DO THIS CLASSNAME COMPARISON

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