Custom Vehicle Movement Help

Hi,

I’m currently trying to create a remote control car that the user controls with WASD and having problems with the mechanics. Currently, the car doesn’t control at all - the spinning basically isn’t there and when it does turn slightly it’s really slowly and there’s no way to correct it. When you press forward, turning basically doesn’t work etc.

I was wondering whether anyone has any tips on creating a vehicle system?

Thanks,

  • Tom :slight_smile:
game.Players.CharacterAutoLoads = false

local RemoteEvents = game.ReplicatedStorage.RemoteEvents
local RunService = game:GetService("RunService")
local MainPart = workspace.Model.MainPart

RemoteEvents.Forward.OnServerEvent:Connect(function()
	if BackwardConnection ~= nil then
		BackwardConnection:Disconnect()
	end
	
	ForwardConnection = game:GetService("RunService").Stepped:Connect(function()
		MainPart.Velocity = Vector3.new(10, 0, 0)
	end)
end)

RemoteEvents.Backward.OnServerEvent:Connect(function()
	if ForwardConnection ~= nil then
		ForwardConnection:Disconnect()
	end
	
	BackwardConnection = RunService.Stepped:Connect(function()
		MainPart.Velocity = Vector3.new(-10, 0, 0)
	end)
end)

RemoteEvents.LeftTurn.OnServerEvent:Connect(function()
	if RightConnection ~= nil then
		RightConnection:Disconnect()
	end
	
	LeftConnection = RunService.Stepped:Connect(function()
		MainPart.BodyAngularVelocity.AngularVelocity = Vector3.new(0, 2, 0)
	end)
end)

RemoteEvents.RightTurn.OnServerEvent:Connect(function()
	if LeftConnection ~= nil then
		LeftConnection:Disconnect()
	end
	
	RightConnection = RunService.Stepped:Connect(function()
		MainPart.BodyAngularVelocity.AngularVelocity = Vector3.new(0, -2, 0)
	end)
end)

RemoteEvents.ForwardOff:Connect(function()
	if ForwardConnection ~= nil then
		ForwardConnection:Disconnect()
		
		if BackwardConnection == nil then
			MainPart.Velocity = Vector3.new(0, 0, 0)
		end
	end
end)

RemoteEvents.BackwardOff:Connect(function()
	if BackwardConnection ~= nil then
		BackwardConnection:Disconnect()
		
		if ForwardConnection == nil then
			MainPart.Velocity = Vector3.new(0, 0, 0)
		end
	end
end)

RemoteEvents.LeftOff:Connect(function()
	if LeftConnection ~= nil then
		LeftConnection:Disconnect()
		
		if RightConnection == nil then
			MainPart.BodyAngularVelocity.AngularVelocity = Vector3.new(0, 0, 0)
		end
	end
end)

RemoteEvents.RightOff:Connect(function()
	if RightConnection ~= nil then
		RightConnection:Disconnect()
	end
	
	if LeftConnection == nil then
		MainPart.BodyAngularVelocity.AngularVelocity = Vector3.new(0, 0, 0)
	end
end)
2 Likes

Dont use remote events for vehicles, its too slow and unresponsive, make sure to set the network ownership, also as far as turning goes check out the dev hub on the basic car, and model their turning you could also use a Motor6D weld just make sure to convert your angles to radians
Also as far as turning with body angular is your force high enough? Try increase it.

1 Like