generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Why does this not make a model spin/rotate?

Previous Thread :: Next Thread 
MirzaFernandez is not online. MirzaFernandez
Joined: 18 Jun 2012
Total Posts: 107
02 Nov 2017 07:39 AM
while true do
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(.0,.03,.0)
wait()
end

Why does a model not spin with this script? (NPC on display)
Report Abuse
MirzaFernandez is not online. MirzaFernandez
Joined: 18 Jun 2012
Total Posts: 107
02 Nov 2017 07:40 AM
It says CFRAME is not a valid member of model.
Report Abuse
Valyrian_Advisor is not online. Valyrian_Advisor
Joined: 13 Apr 2013
Total Posts: 1703
02 Nov 2017 07:49 AM
Because models don't have a CFrame,first set a part of the model as primary part of this model.
Then use :SetPrimaryPartCFrame


Report Abuse
MirzaFernandez is not online. MirzaFernandez
Joined: 18 Jun 2012
Total Posts: 107
02 Nov 2017 07:55 AM
Wait how would that look I'm confused ?
Report Abuse
Kiriot22 is not online. Kiriot22
Joined: 19 Jul 2015
Total Posts: 226
02 Nov 2017 07:58 AM
script.Parent.PrimaryPart = set this to the part which you want to rotate the model along
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(0.03), 0))
Report Abuse
Valyrian_Advisor is not online. Valyrian_Advisor
Joined: 13 Apr 2013
Total Posts: 1703
02 Nov 2017 08:01 AM
Sorry, I should've explained better, I'm doing 3 things at time ehe, ^ he told you tho.


Report Abuse
MirzaFernandez is not online. MirzaFernandez
Joined: 18 Jun 2012
Total Posts: 107
02 Nov 2017 08:01 AM
So it'd be this in my script?

script.Parent.PrimaryPart = "Torso"
script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(0.03), 0))
Report Abuse
Valyrian_Advisor is not online. Valyrian_Advisor
Joined: 13 Apr 2013
Total Posts: 1703
02 Nov 2017 08:03 AM
script.Parent.PrimaryPart = script.Parent.Torso


Report Abuse
MirzaFernandez is not online. MirzaFernandez
Joined: 18 Jun 2012
Total Posts: 107
02 Nov 2017 10:59 AM
It still doesn't work rip.
Report Abuse
hokyboy is not online. hokyboy
Joined: 31 Jan 2014
Total Posts: 115
02 Nov 2017 11:43 AM
U dident add a rostion script
u can cframe the rotation if u wanna do that maybe watch on youtube a vid
Report Abuse
JoeDeveloper is not online. JoeDeveloper
Joined: 01 Aug 2013
Total Posts: 999
02 Nov 2017 11:51 AM
--
row:SetPrimaryPartCFrame(Row:GetPrimaryPartCFrame(Row.PrimaryP) * CFrame.fromEulerAnglesXYZ(0,-0.1,0))
--
This had a model called Row with parts in it, I set the primary part to a part (inside the model) called PrimaryP.

But I can't remember if this worked 'cause I don't have it used and I haven't tested it before I wrote this 'cause I'm too lazy. But, try it anyway.

OR you could use a tween.
--
for _,row in pairs(script.Parent.Floor.Row:GetChildren()) do
local Info = TweenInfo.new(
2,
Enum.EasingStyle.Quad,
Enum.EasingDirection.InOut,
0,
true,
0
)
local Goals =
{
Orientation = Vector3.new(0,0,360)
}
local tween = tweenserv:Create(row,Info,Goals)
tween:Play()
end
--
Though this only moves individual parts unfortunately but it's smoother.

Or I suppose you could try a for loop, but it also just moves individual parts for each iteration.

for cframe = 1,15,1 do wait()
for _,part in pairs(script.Parent.Floor.Row1:GetChildren()) do
part.CFrame = part.CFrame * CFrame.new(0.2,0,0.2)
end
end

Report Abuse
MirzaFernandez is not online. MirzaFernandez
Joined: 18 Jun 2012
Total Posts: 107
02 Nov 2017 11:51 AM
All I want is it to spin 360 degrees constantly what would be the script I need then?
Report Abuse
JoeDeveloper is not online. JoeDeveloper
Joined: 01 Aug 2013
Total Posts: 999
02 Nov 2017 11:55 AM
Is it one part inside a model?

Or is it multiple parts inside of a model, right?

Report Abuse
Valyrian_Advisor is not online. Valyrian_Advisor
Joined: 13 Apr 2013
Total Posts: 1703
02 Nov 2017 11:56 AM
while true do
script.Parent.PrimaryPart = script.Parent.Torso
script.Parent:SetPrimaryPartCFrame(script.Parent:GetPrimaryPartCFrame * CFrame.Angles(0, math.rad(0.03), 0))
end


If it doesn't work post the output errors,


Report Abuse
MirzaFernandez is not online. MirzaFernandez
Joined: 18 Jun 2012
Total Posts: 107
02 Nov 2017 11:57 AM
Its for multiple parts inside a model inside a Local Script which is inside the StarterGUI

It's basically an NPC that wears the morphs before you spawn so you can preview them.

So, it has the left/right arm, left/right leg, torso and head and humanoid.
Report Abuse
MirzaFernandez is not online. MirzaFernandez
Joined: 18 Jun 2012
Total Posts: 107
02 Nov 2017 11:58 AM
############ - Torso is not a valid member of Model ############ - Stack Begin ############ - Script 'Workspace.Model.Script', Line 1 ############ - Stack End ############ - Players.MirzaFernandez.PlayerGui.Morph Selection.Scripts.LocalScript.DevTrooper:3: function arguments expected near '*' ############ - Workspace.DevTrooper.Script:3: function arguments expected near '*' Thats weird cause Torso is in the model.......
Report Abuse
Valyrian_Advisor is not online. Valyrian_Advisor
Joined: 13 Apr 2013
Total Posts: 1703
02 Nov 2017 11:58 AM
Put the script inside the model.
Again, if a script doesn't work you should look at the output and post it and try understanding what's wrong. If you really don't get it post the output here, it is much easier to help if we can see it.


Report Abuse
JoeDeveloper is not online. JoeDeveloper
Joined: 01 Aug 2013
Total Posts: 999
02 Nov 2017 11:59 AM
Dude that will crash his studio, you need to put a wait in there lol.

local WantMeToSpin = true -- So you can turn this loop on and off as you please (within this script)

while wait() and WantMeToSpin do
script.Parent.PrimaryPart = script.Parent.Torso
script.Parent:SetPrimaryPartCFrame(script.Parent:GetPrimaryPartCFrame * CFrame.Angles(0, math.rad(0.03), 0))
end

Report Abuse
MirzaFernandez is not online. MirzaFernandez
Joined: 18 Jun 2012
Total Posts: 107
02 Nov 2017 11:59 AM
The script is in the model already.
Report Abuse
Valyrian_Advisor is not online. Valyrian_Advisor
Joined: 13 Apr 2013
Total Posts: 1703
02 Nov 2017 12:00 PM
Torso is not a valid member of model? Then the torso is not in the same model as the script, if it is and still get this error try:
script.Parent.PrimaryPart = script.Parent:WaitForChild("Torso")


Report Abuse
Valyrian_Advisor is not online. Valyrian_Advisor
Joined: 13 Apr 2013
Total Posts: 1703
02 Nov 2017 12:01 PM
Lol Joe I totally forgot the wait , thanks for noticing it before he crashed ehehe.


Report Abuse
MirzaFernandez is not online. MirzaFernandez
Joined: 18 Jun 2012
Total Posts: 107
02 Nov 2017 12:02 PM
Still says its not in the model... It is in the model I would send a picture but ##### doesn't work here...
Report Abuse
JoeDeveloper is not online. JoeDeveloper
Joined: 01 Aug 2013
Total Posts: 999
02 Nov 2017 12:04 PM
First, take out the script from the model. A script has no CFrame. Otherwise it will error.

Second, click the model and click the PrimaryPart, and then click the part you want to be the primary part (try to put it at the center of it all).

Third, name the part and call it Torso.

Try that.

Report Abuse
MirzaFernandez is not online. MirzaFernandez
Joined: 18 Jun 2012
Total Posts: 107
02 Nov 2017 12:07 PM
The Torso problem is fixed, now its just. the two last output errors.

Players.MirzaFernandez.PlayerGui.Morph Selection.Scripts.LocalScript.DevTrooper:5: function arguments expected near '*'

Workspace.DevTrooper.Script:5: function arguments expected near '*'

Also this isn't in the workspace it's in StarterGUI.
Report Abuse
ShadowR_Dev is not online. ShadowR_Dev
Joined: 28 Feb 2016
Total Posts: 99
02 Nov 2017 12:12 PM
In that case..

model = game.Workspace.MODELNAME
model.PrimaryPart = model:WaitForChild("Torso")


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image