Scriptin problem
local car = script:WaitForChild("Car").Value
local Seat=car.Seat
local DriveFL=car.DrivingPartLF.HingeConstraint
local DriveFR=car.DrivingPartFR.HingeConstraint
local DriveBL=car.DrivingPartLB.HingeConstraint
local DriveBR=car.DrivingPartRB.HingeConstraint
local SteerFL=car.SteeringPartLF.HingeConstraint
local SteerFR=car.SteeringPartFR.HingeConstraint
local UserInputService=game:GetService('UserInputService')
while Seat.Occupant do
wait()
local player = game.Players:GetPlayerFromCharacter(Seat.Occupant.Parent)
if player then
if UserInputService:IsKeyDown(100)==true then
if SteerFR.TargetAngle\~=32 and SteerFL.TargetAngle\~=32 then
SteerFR.TargetAngle=32
SteerFL.TargetAngle=32
--A wait here?
SteerFR.LowerAngle=32
SteerFR.UpperAngle=32
SteerFL.LowerAngle=32
SteerFL.UpperAngle=32
end
elseif UserInputService:IsKeyDown(97)==true then
if SteerFR.TargetAngle\~=-32 and SteerFL.TargetAngle\~=-32 then
SteerFR.TargetAngle=-32
SteerFL.TargetAngle=-32
SteerFR.LowerAngle=-32
SteerFR.UpperAngle=-32
SteerFL.LowerAngle=-32
SteerFL.UpperAngle=-32
end
else
SteerFR.TargetAngle=0
SteerFL.TargetAngle=0
SteerFR.LowerAngle=0
SteerFR.UpperAngle=0
SteerFL.LowerAngle=0
SteerFL.UpperAngle=0
end
if UserInputService:IsKeyDown(119)==true then
if DriveBL.AngularVelocity\~=34 and DriveBR.AngularVelocity\~=-34 and DriveFL.AngularVelocity\~=34 and DriveFR.AngularVelocity\~=-34 then
DriveBL.AngularVelocity=34
DriveBR.AngularVelocity=-34
DriveFL.AngularVelocity=34
DriveFR.AngularVelocity=-34
end
elseif UserInputService:IsKeyDown(115)==true then
if DriveBL.AngularVelocity\~=-20 and DriveBR.AngularVelocity\~=20 and DriveFL.AngularVelocity\~=-20 and DriveFR.AngularVelocity\~=20 then
DriveBL.AngularVelocity=-20
DriveBR.AngularVelocity=20
DriveFL.AngularVelocity=-20
DriveFR.AngularVelocity=20
end
else
DriveBL.AngularVelocity=0
DriveBR.AngularVelocity=0
DriveFL.AngularVelocity=0
DriveFR.AngularVelocity=0
end
end
end
Hello,
I have this problem that i want to lock the wheels with limits so the wheels dont wobble when I drive, but if I add a wait (see script(The wait needs to be there to prevent it from jumping to that angle immediatly) it slows down the entire script. Is there a way to run that part of the script and just let the script proceed immediatly? or another way to fix this?
Any help is appreciated.
Posted Dec 30, 2019, 10:19 PM UTC
Use a remote event
Can you explain?
U have to use a remote event so u can fire it. Ur other script will run and the other part will run when fired