I am trying to make a bicycle script that uses raycasting to tell the script what my AssemblyLinerarVelocity should be. What I want to do is have a ray in the center of the first wheel and turn whenever the wheel turns but I do not know where to start.
Here is my code:
local bike = script.Parent
local vehicleseat = bike.VehicleSeat
local wheel1 = bike.Wheel1
local debounce = false
vehicleseat:GetPropertyChangedSignal("Occupant"):Connect(function()
print("it works")
local hum = vehicleseat.Occupant
local char = hum.Parent
vehicleseat:GetPropertyChangedSignal("Steer"):Connect(function()
if not debounce then
debounce = true
wheel1.Orientation = Vector3.new(0,-45*vehicleseat.Steer,0)
wait(0.05)
debounce = false
end
end)
vehicleseat:GetPropertyChangedSignal("Throttle"):Connect(function()
end)
local ray = Ray.new(wheel1.Position,wheel1.)
end)~~~~~~~~~~~~~~~~~
