Need some help with my Mechsuit model

So, I am trying to make a Mechsuit vehicle. It’s attacks work preffy fine but it’s movement causes lag.

Here is a gif:
https://gyazo.com/29020de3c133fe2239005f537d76997f

Here is the code: (LocalScript)

wait()

local player = game.Players.LocalPlayer

local mouse = player:GetMouse()

local Down = false

local RunService = game:GetService("RunService")
	
if script.Tank.Value ~= nil then
	mouse.Button1Down:Connect(function()
		if script.Tank.Value ~= nil then
			Down = true
		end
	end)
		
	mouse.Button1Up:Connect(function()
		if script.Tank.Value ~= nil then	
			Down = false
		end
	end)
		
	mouse.KeyDown:Connect(function(key)
		if script.Tank.Value ~= nil then
			script.Tank.Value.Events.KeyDown:FireServer(key)
		end
	end)
		
	mouse.KeyUp:Connect(function(key)
		if script.Tank.Value ~= nil then
			script.Tank.Value.Events.KeyUp:FireServer(key)
		end
	end)
		
	script.Tank.Value.Humanoid.Died:Connect(function()
		if script.Tank.Value ~= nil then	
			script.Tank.Value.Events.Death:FireServer()
		end
	end)
	RunService.Stepped:Connect(function()
		if script.Tank.Value ~= nil then
			script.Tank.Value.Events.Start:FireServer(mouse.hit.p, mouse.target)
		end
		wait()
	end)
	RunService.Stepped:Connect(function()
		if script.Tank.Value ~= nil then
			if Down == true then
				script.Tank.Value.Events.Down:FireServer(mouse.hit.p)
			else
				script.Tank.Value.Events.Up:FireServer()
			end
		end
		wait(.5)
	end)
end
2 Likes