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: Subject title cannot be more than 60 characters.

Previous Thread :: Next Thread 
CoolJohnnyboy is not online. CoolJohnnyboy
Joined: 09 Mar 2010
Total Posts: 17699
05 Jul 2012 08:45 PM
This script is supposed to stop the car from moving when the 'gas' value is 0, and when the 'gas' value is NOT 0, the car can move. Please help me with this script. Thanks. Here is the script:

if script.Parent.Value == 0 then
script.Parent.Parent.VehicleSeat.MaxSpeed = 0
elseif script.Parent.Value > 0 then
script.Parent.Parent.VehicleSeat.MaxSpeed = 30
end
Report Abuse
Hetica is not online. Hetica
Joined: 02 Apr 2012
Total Posts: 115
05 Jul 2012 08:57 PM
script.Parent.Changed:connect(function(c)
if (c=="Value") then
local val = script.Parent.Value
if (val<1) then
script.Parent.Parent["VehicleSeat"].MaxSpeed = 0
else
script.Parent.Parent["VehicleSeat"].MaxSpeed = 30
end
end
end)
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
05 Jul 2012 08:58 PM
Your script is only checking once, and then it proceeds. Make it so it checks every time the vehicle accellerates.

local seat = script.Parent.Parent.VehicleSeat
local gas = script.Parent
seat.Changed:connect(function(property)
if property == "Throttle" and gas.Value <= 0 then
seat.MaxSpeed = 0
end
end)
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
05 Jul 2012 08:59 PM
Hetica's will work better. Didn't think of the changed event on the gas value :/
Report Abuse
CoolJohnnyboy is not online. CoolJohnnyboy
Joined: 09 Mar 2010
Total Posts: 17699
05 Jul 2012 09:07 PM
Hetica's won't work. Idk why, mabye because of the script that changes the gas value. If it is why the script Hetica posted, then someone please change it so it works with Hetica's. Here is the script that changes the gas value:

while wait(20) do
if script.Parent.Value > 0 then
script.Parent.Value = script.Parent.Value - 1
end
end
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
06 Jul 2012 01:01 PM
I think I know what's wrong with Hetica's. Make sure the script is inside the gas value.

gas = script.Parent

gas.Changed:connect(function()
if gas.Value < 1 then
script.Parent.Parent["VehicleSeat"].MaxSpeed = 0
end
end)
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