Ace23333
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 1341 |
|
|
| 14 Apr 2014 04:59 PM |
speed = script.Speed.Value
if speed >= 0 and speed <= 20 and Seat.MaxSpeed == 60 then Seat.MaxSpeed = 20 script.Gear.Value = 1 print("Gear 1") end
So this was meant if Car speed falls under 20 it should shift down automatically... It wont work at all, nor output shows something up... Not even "Gear 1" Although speed is working, this script isn't |
|
|
| Report Abuse |
|
|
Ace23333
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 1341 |
|
|
| 14 Apr 2014 05:04 PM |
| B1.. Cmon guys.. Its annoying me whole day... |
|
|
| Report Abuse |
|
|
Ace23333
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 1341 |
|
| |
|
|
| 14 Apr 2014 05:10 PM |
| How often does that conditional statement check the value of speed? |
|
|
| Report Abuse |
|
|
Ace23333
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 1341 |
|
|
| 14 Apr 2014 05:13 PM |
| How do you mean... Speed is defined in another script, which is checking speed Value every 0.01 second if you mean that... Also this script should check it every time it falls down to 20 or less... |
|
|
| Report Abuse |
|
|
|
| 14 Apr 2014 05:14 PM |
This script has nothing to check if the speed value changes :P
Or if it does I can't see it. |
|
|
| Report Abuse |
|
|
Ace23333
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 1341 |
|
|
| 14 Apr 2014 05:16 PM |
| Yeah... The biggest problem is I have no idea how to do that, since I am a bit of a newb... 0:) |
|
|
| Report Abuse |
|
|
Ace23333
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 1341 |
|
|
| 14 Apr 2014 05:17 PM |
If you need Script that checks speed here it is:
script.Parent.ChildAdded:connect(function() while wait(0.01) do local speed = math.sqrt(script.Parent.Velocity.x^2 + script.Parent.Velocity.y^2 + script.Parent.Velocity.z^2) wait(0.01) script.Parent.Transmission.Speed.Value = speed end end)
Another script though |
|
|
| Report Abuse |
|
|
Ace23333
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 1341 |
|
| |
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 14 Apr 2014 05:27 PM |
| Ace, you mention that the 'speed' variable is defined in another script. By "another script", do you mean a separate script object in the Workspace/wherever, because that could be why. |
|
|
| Report Abuse |
|
|
Ace23333
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 1341 |
|
| |
|
Ace23333
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 1341 |
|
|
| 14 Apr 2014 05:30 PM |
Sorry about that "Cmon I need an answer..."
Yeah It is in separate script, but I couldn't do it differently, It would stop script... Also I have no idea what problem is... If you need model of seat so you can check the scriptings inside I will give you it. |
|
|
| Report Abuse |
|
|
Ace23333
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 1341 |
|
| |
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 14 Apr 2014 05:41 PM |
You can use a coroutine to have a function run simultaneous to the rest of the script, look
speed = 0
updateSpeed = coroutine.wrap(function() while wait(0.15) do speed = script.Parent.Velocity.Magnitude end end)
updateSpeed()
--rest of code, ie
while wait(0.15) do
if speed >= 20 and speed > 0 then gear = balbla end
end |
|
|
| Report Abuse |
|
|
Ace23333
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 1341 |
|
|
| 14 Apr 2014 05:44 PM |
| Ok thank you, I will try that C: |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 14 Apr 2014 05:45 PM |
| Np, yw. I'm off to bed now, so if this still isn't working how you like, pm me or somet. Ciao |
|
|
| Report Abuse |
|
|
Ace23333
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 1341 |
|
|
| 14 Apr 2014 05:51 PM |
| Bye, it worked perfectly btw C: |
|
|
| Report Abuse |
|
|