I'm having an issue with this script for when you touch a part the car will move forward. the script itself without the game.Workspace works but it immediately starts the script and touching the panel won't do anything. I was trying to get it so when you're walking you touch the part and the car moves forwards away from you. Here's the script
game.Workspace.car2:OnTouched() while true do wait() for i= 1, 300 do script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,0,-2) wait() end for i= 1, 300 do script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,0,2) wait() end end
You don't actually have an event for touching the car. You need to create an event function for touching the car first, which would look something like this:
local CarTouched = false game.Workspace.car2.Touched:connect(function(obj) if not CarTouched and obj.Parent:FindFirstChild("Humanoid") then CarTouched = true while true do wait() for i= 1, 300 do script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,0,-2) wait() end for i= 1, 300 do script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,0,2) wait() end end end end)
This script makes it so that once the part is touched, the car starts moving. The way you had it made it so that the car started moving without the event actually firing, meaning you didn't even need to touch the part in order for the car to start moving.
I hope this helps! :)