AC6 Weird bug/glitch

Hey!
Today while making a script for A-chassis car we faced some very weird bug. We have a script that should be moving the spirit of Ecstasy up and down depending is the Engine on or off. Script:

-- Siromanets was here

script.Parent.Anchored = false

local PositioningWeld = script.Parent.PositioningWeld

local UpPosition = PositioningWeld.C0
local TweenService = game:GetService('TweenService')

local WaitTime = 1.5
local TInfo = TweenInfo.new(WaitTime, Enum.EasingStyle.Linear)

local Debounce = false

local function CheckEngineState()
  local Engine = script.Parent.Parent.Parent.Parent.Parent.DriveSeat.Engine
  if Engine then
    if Debounce then return end
    Debounce = true
    
    local EngineState = Engine.Value

    if EngineState == true then
      print("Engine is ON")
      TweenService:Create(PositioningWeld, TInfo, { C0 = CFrame.new(0, 0, 0) }):Play()
    elseif EngineState == false then
      print("Engine is OFF")
      TweenService:Create(PositioningWeld, TInfo, { C0 = UpPosition }):Play()
    end

    Debounce = false
  else
    print("Engine Not Found")
  end
end

while true do
  CheckEngineState()
  print("Checking Engine State")
  task.wait(1)
end

Video on which you can see that both Engine and IsOn value are on however the script says that Engine is off: Watch 2024-11-08 18-32-50 | Streamable

1 Like

Also, here is a car ignition script:

local car = script.Parent:WaitForChild("Car")
local userInputService = game:GetService("UserInputService")
local engineTurnOnDelay = 1
local soundPlayingDelay = 5
local keyCode = Enum.KeyCode.G

script.Start.Parent = car.Value.DriveSeat

function StartEngine()
  car.Value.DriveSeat:WaitForChild("Start"):Play()
  
  wait(engineTurnOnDelay)
  
  car.Value.DriveSeat:WaitForChild("Engine").Value = true
  script.Parent.IsOn.Value = true
  
  wait(soundPlayingDelay)
  
  car.Value.DriveSeat:WaitForChild("Start"):Stop()
end

function StopEngine()
  
  car.Value.DriveSeat:WaitForChild("Engine").Value = false
  script.Parent.IsOn.Value = false
  
end

keyPressed = false
startingEngine = false

userInputService.InputChanged:connect(function(L_7_arg1, L_8_arg2)
  if L_8_arg2 == false then
    local L_9_ = userInputService:GetKeysPressed()
    
    for L_10_forvar1, L_11_forvar2 in pairs(L_9_) do
      if L_11_forvar2.KeyCode == keyCode then
        keyPressed = true
      end
    end
    
    if keyPressed == true and startingEngine == false then
      
      startingEngine = true
      
      if script.Parent.IsOn.Value == false then
        StartEngine()
      else
        StopEngine()
      end
      
      keyPressed = false
      wait(2)
      
      startingEngine = false
    end
  end
end)

script.Parent.IsOn.Changed:Connect(function()
  script.Parent.IgnitionStatus.Text = script.Parent.IsOn.Value and "Engine: On" or "Engine: Off"
end)

1 Like