I was made this script but the On/Off switch is in the platform itself meaning that I have to click the moving platform to stop it. I want the button to be separate. I need help with this. I'm new to scripting.

I can send you a video of what I mean on Discord @Sean_lbgl#3098

local car = script.Parent

local click = car:FindFirstChildWhichIsA('ClickDetector').MouseClick
local stopped = false

click:Connect(function()
    stopped = not stopped
end)

while true do
    wait(10)
    for i = 1, 43 do
        if stopped then click:Wait() end

        car:TranslateBy(Vector3.new(0,0,-1))
        wait()
    end

    for i = 1, 43 do
        if stopped then click:Wait() end

        car:TranslateBy(Vector3.new(0,0,1))
        wait()
    end
end