#Chassis

28 messages · Page 1 of 1 (latest)

formal gale
#

Lua***

#

I need to create a chassis with a power button but I can't find anywhere that tells me how.

faint torrent
#

what do you mean by “with a power button”

#

just need some clarification

formal gale
faint torrent
#

not to be rude by any means, but most people (including myself) wouldn’t be willing to help you because you’re basically asking for a script to be made for you

#

i highly recommend you learn how to code in lua

formal gale
#

Sorry but I don't know how to do it, I'm new and I can't find any tutorial

formal gale
#

thanks

faint torrent
#

yeah, of course

#

if you ever need help on a code, that’s when you can come here and make a post (post the code too)

formal gale
#

How can I post the code?

#

because I have a code but something is wrong

#

-- Referencias
local driveSeat = script.Parent -- Asiento del vehículo (DriveSeat)
local player = game.Players.LocalPlayer
local gui = player:WaitForChild("PlayerGui"):WaitForChild("MotorGUI") -- Referencia a la GUI
local botonEncendido = gui:WaitForChild("BotonEncendido") -- El botón en pantalla

local motorEncendido = false -- Estado del motor
local motor = workspace:WaitForChild("Motor") -- Referencia al motor

-- Lista de piezas requeridas
local piezasRequeridas = {
motor:FindFirstChild("Admisión"),
motor:FindFirstChild("Batería"),
motor:FindFirstChild("Bloque de motor"),
motor:FindFirstChild("Colector de escape"),
motor:FindFirstChild("Correa"),
motor:FindFirstChild("Radiador"),
motor:FindFirstChild("Tapa de motor")
}

-- Función para verificar todas las piezas
local function verificarPiezas()
for _, pieza in pairs(piezasRequeridas) do
if not pieza or not pieza:IsDescendantOf(motor.Parent) then
return false
end
end
return true
end

-- Función para alternar el estado del motor
local function alternarMotor()
if verificarPiezas() then
if motorEncendido then
print("Motor apagado.")
motorEncendido = false
-- Aquí iría el código para apagar el motor
else
print("Motor encendido.")
motorEncendido = true
-- Aquí iría el código para encender el motor
end
else
print("Faltan piezas. No se puede encender el motor.")
end
end

#

-- Función para actualizar la visibilidad del botón
local function actualizarBotonVisibilidad()
if driveSeat.Occupant then
-- Mostrar el botón cuando el jugador se siente
botonEncendido.Visible = true
else
-- Ocultar el botón cuando el jugador se levanta
botonEncendido.Visible = false
end
end

-- Detectar cambios en el "Occupant" del DriveSeat
driveSeat:GetPropertyChangedSignal("Occupant"):Connect(actualizarBotonVisibilidad)

-- Inicializar la visibilidad del botón al inicio
actualizarBotonVisibilidad()

-- Conectar el botón en pantalla al encendido del motor
botonEncendido.MouseButton1Click:Connect(alternarMotor)

faint torrent
#

oh my

#

yeah my spanish is no bueno

#

there’s a format to put the code in

#

use those backticks and the word lua

#

then place ur code where the print is

formal gale
#

(Script)?

#

srry my english isnt good

#

i understan

rancid jewelBOT
#

studio** You are now Level 3! **studio

faint torrent
#

they are the same word