make a AI neural network that tries to navigate through the map and get to the finish line and each 20 seconds he restarts and gets put back to its original cframe using this roblox script "local AIBody = script.Parent -- this will be used in the deep neural network
-- bodyvelocity
local movement = Instance.new("BodyVelocity")
movement.Parent = AIBody
movement.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
movement.Velocity = Vector3.new(0,0,0)
-- get the finish line
local finishingPart = game.Workspace:WaitForChild("Finish")
-- shoots 5 rays
local distance = (AIBody.Position - finishingPart.Position).Magnitude -- ♦ this will be used in the deep neural network as an input

local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Blacklist
params.FilterDescendantsInstances = {workspace.Baseplate}
local directionEMLR = script.Parent.EvenMoreLeftRay.Position - AIBody.Position
local directionLR = script.Parent.LeftRay.Position - AIBody.Position
local directionMR = script.Parent.MiddleRay.Position - AIBody.Position
local directionRR = script.Parent.RightRay.Position - AIBody.Position
local directionEMRR = script.Parent.EvenMoreRightRay.Position - AIBody.Position

local ray1 = workspace:Raycast(AIBody.Position,directionEMLR,params).Position -- ♦ this will be used in the deep neural network as an input
local ray2 = workspace:Raycast(AIBody.Position,directionLR,params).Position -- ♦ this will be used in the deep neural network as an input
local ray3 = workspace:Raycast(AIBody.Position,directionMR,params).Position -- ♦ this will be used in the deep neural network as an input
local ray4 = workspace:Raycast(AIBody.Position,directionRR,params).Position -- ♦ this will be used in the deep neural network as an input
local ray5 = workspace:Raycast(AIBody.Position,directionEMRR,params).Position -- ♦ this will be used in the deep neural network as an input
spawn(function()
	while true do -- UPDATES THE SCRIPT (⚠IGNORE⚠)
		task.wait(0.5)
		distance = (AIBody.Position - finishingPart.Position).Magnitude
		print(distance)
		directionEMLR = script.Parent.EvenMoreLeftRay.Position - AIBody.Position
		directionLR = script.Parent.LeftRay.Position - AIBody.Position
		directionMR = script.Parent.MiddleRay.Position - AIBody.Position
		directionRR = script.Parent.RightRay.Position - AIBody.Position
		directionEMRR = script.Parent.EvenMoreRightRay.Position - AIBody.Position
		ray1 = workspace:Raycast(AIBody.Position,directionEMLR,params).Position
		ray2 = workspace:Raycast(AIBody.Position,directionLR,params).Position
		ray3 = workspace:Raycast(AIBody.Position,directionMR,params).Position
		ray4 = workspace:Raycast(AIBody.Position,directionRR,params).Position
		ray5 = workspace:Raycast(AIBody.Position,directionEMRR,params).Position
	end
end)
-- movement functions
local stopped = true
local function RotateLeft() -- ♦ this will be used in the deep neural network as an Output
	AIBody.CFrame = AIBody.CFrame * CFrame.Angles(0,math.rad(15),0)
end

local function RotateRight() -- ♦ this will be used in the deep neural network as an Output
	AIBody.CFrame = AIBody.CFrame * CFrame.Angles(0,math.rad(-15),0)
end

local function MoveFoward() -- ♦ this will be used in the deep neural network as an Output
	 stopped = false
	 spawn(function()
		while stopped == false do
			task.wait(0.05)
			movement.Velocity = AIBody.CFrame.LookVector * 10
			if stopped == true then
				movement.Velocity = Vector3.new(0,0,0)
			end
		end
	 end)
end

local function MoveBackward() -- ♦ this will be used in the deep neural network as an Output
	stopped = false
	spawn(function()
		while stopped == false do
			task.wait(0.05)
			movement.Velocity = AIBody.CFrame.LookVector * -10
			if stopped == true then
				movement.Velocity = Vector3.new(0,0,0)
			end
		end
	end)
end

local function StopMoving() -- ♦ this will be used in the deep neural network as an Output
	stopped = true
	movement.Velocity = Vector3.new(0,0,0)
end"
ive marked each input and output so that you can use them.
the rays should be his vision / input
and the distance from the body to finish line should also be an input
after each restart, the AI learns from his previous round's input and output. basically the previous things he did.
it should be a fully working neural network
he gets points if he gets near the finish line (5 studs away)