I'm trying to make a script that can detect the status of a vehicle through the SeatPart for a racing game. I've been trying to the best of my ability for the past few months, but nothing's been working. I think I'm on the right track with this one, but I could use a nudge in the right direction.
script.Parent.Touched:Connect(function(hit) while true do if script.Parent.Humanoid.SeatPart.Steer == 1 then print("TurnRight") end end end)
From what I've seen that your trying to do. Is to, detect if the steer of seat part is set to 1(right). But, it doesn't really work that way. The steer value of seat part is constantly reset to 0 unless stated otherwise. A good counteraction to this is to, detect when the player is in the seat...aka.(SeatPart.Occupant). If they are in the seat, take input from that player, aka.(UserInputService). When that player, presses "A" or "D", set the steer of seat part to 1(right) or -1(left), then your current script will be able to detect when it is set to 1. Remember, you also have SeatPart.Throttle, where you can set 1(forward, "W") and -1(reverse, "S").
Hope This Helped!