|
| 21 Feb 2014 02:27 PM |
ok,well I want to make something rotate,but STOP rotating when it gets to a certain point.. heres what I tried(p.s Im using welds) turret = script.Parent w = Instance.new("Weld",turret) w.Part0 = w.Parent w.Part1 = w.Parent.Parent.MainPart w.C0 = CFrame.new(0,-5,0)*CFrame.new(0,math.pi,0) rotating = script.Parent.Direction while wait(0.1) do if rotating.Value == "right" and script.Parent.Rotation.X < 91 and script.Parent.Rotation.Z < 90 then w.C0 = w.C0*CFrame.Angles(0,0.1,0) elseif rotating.Value == "left" then w.C0 = w.C0*CFrame.Angles(0,-0.1,0) end end |
|
|
| Report Abuse |
|
|
|
| 21 Feb 2014 02:28 PM |
but it keeps rotating past the point I want it to.. I only want it to make a 180 degree turn,and stop..but it goes the full 360 :\ |
|
|
| Report Abuse |
|
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
|
| 21 Feb 2014 02:30 PM |
| Use the changed function of the cframe property or rotation? And trigger it to stop? |
|
|
| Report Abuse |
|
|
|
| 21 Feb 2014 02:30 PM |
| I know its only been 2 minutes..but Bump..its probably really simple :\ |
|
|
| Report Abuse |
|
|
|
| 21 Feb 2014 02:31 PM |
@baheeg,im trying to make it so it only rotates to a certain point.. and ive like NEVER used .Changed events..:( |
|
|
| Report Abuse |
|
|
|
| 21 Feb 2014 02:36 PM |
-no one looking?..ok here goes..- *sneaky bump |
|
|
| Report Abuse |
|
|
| |
|
velibor
|
  |
| Joined: 24 Nov 2009 |
| Total Posts: 1003 |
|
|
| 21 Feb 2014 02:47 PM |
Use 'repeat until' http://wiki.roblox.com/index.php?title=Repeat#The_.27repeat.27_Statement |
|
|
| Report Abuse |
|
|
|
| 21 Feb 2014 02:50 PM |
| im using a "while wait(0.1) do" because I want it to ALWAYS rotate to the right if rotating.Value is equal to "right" and I want it to stop if it rotates to a certain point,but then rotate the other way it rotating.Value is equal to "left".. |
|
|
| Report Abuse |
|
|
|
| 21 Feb 2014 02:53 PM |
never mind,i used a variable to control it: turret = script.Parent rotate = 0 w = Instance.new("Weld",turret) w.Part0 = w.Parent w.Part1 = w.Parent.Parent.MainPart w.C0 = CFrame.new(0,-5,0)*CFrame.new(0,math.pi,0) rotating = script.Parent.Direction while wait(0.1) do if rotating.Value == "right" and rotate<1.6 then rotate = rotate+0.1 w.C0 = w.C0*CFrame.Angles(0,0.1,0) elseif rotating.Value == "left" and rotate>-1.6 then rotate = rotate-0.1 w.C0 = w.C0*CFrame.Angles(0,-0.1,0) end end |
|
|
| Report Abuse |
|
|