Categories > Coding > Lua >

help with driving simulator gui

Posts: 1

Threads: 1

Joined: Mar, 2021

Reputation: 0

Posted

How do I make car move forward by script?

I am viewing this game with dex explorer for 3 days now and I can't find how can I move the car forward by my script

 

edit:

i tried doing it like this:

local function autofarm()
	while true do
		if (autofarmEnabled) then
			local playerCar = getCar() -- Get players car
			
			-- Constraints
			local LBconstraint = playerCar.Wheels.LB.CylindricalConstraint
			local LFconstraint = playerCar.Wheels.LF.CylindricalConstraint
			local RBconstraint = playerCar.Wheels.RB.CylindricalConstraint
			local RFconstraint = playerCar.Wheels.RF.CylindricalConstraint
			
			-- Apply wheel velocity
			LBconstraint.AngularVelocity = -262.86
			LFconstraint.AngularVelocity = -262.86
			RBconstraint.AngularVelocity = -262.86
			RFconstraint.AngularVelocity = -262.86
			
			-- Apply torque
			LBconstraint.MotorMaxTorque = LBconstraint.MotorMaxTorque - 0.1
			LFconstraint.MotorMaxTorque = LFconstraint.MotorMaxTorque - 0.1
			RBconstraint.MotorMaxTorque = RBconstraint.MotorMaxTorque - 0.1
			RFconstraint.MotorMaxTorque = RFconstraint.MotorMaxTorque - 0.1
			
			-- Get Aeroforce
			local AeroForce = playerCar.RootPart.AeroForce
			
			-- Calculate new aeroforce
			local newValue = AeroForce.Force.y + 0.1
			
			-- Apply aeroforce
			AeroForce.Force = Vector3.new(0, newValue, 0)
		else
			break
		end
		wait(0.1)
	end
end
  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )