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 » Scripting Helpers
Home Search
 

Re: Why wont this work?

Previous Thread :: Next Thread 
Ace23333 is not online. 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 is not online. 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 is not online. Ace23333
Joined: 20 Nov 2011
Total Posts: 1341
14 Apr 2014 05:10 PM
B2

Please?
Report Abuse
wonderful72pike is online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
14 Apr 2014 05:10 PM
How often does that conditional statement check the value of speed?
Report Abuse
Ace23333 is not online. 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
wonderful72pike is online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
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 is not online. 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 is not online. 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 is not online. Ace23333
Joined: 20 Nov 2011
Total Posts: 1341
14 Apr 2014 05:23 PM
Bump
Report Abuse
RoflBread is not online. 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 is not online. Ace23333
Joined: 20 Nov 2011
Total Posts: 1341
14 Apr 2014 05:27 PM
Cmon I need an answer...
Report Abuse
Ace23333 is not online. 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 is not online. Ace23333
Joined: 20 Nov 2011
Total Posts: 1341
14 Apr 2014 05:40 PM
Bump
Report Abuse
RoflBread is not online. 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 is not online. 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 is not online. 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 is not online. Ace23333
Joined: 20 Nov 2011
Total Posts: 1341
14 Apr 2014 05:51 PM
Bye, it worked perfectly btw C:
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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