So i made a script that runs a code when both player seated on their seat
local boySeat = script.Parent.Boy
local girlSeat = script.Parent.Girl
local franxActivated = false
while wait(1) do
if franxActivated == false and boySeat.Occupant == “Humanoid” and girlSeat.Occupant == “Humanoid” then
print(“Franx Activated”)
--- Do stuffs here like activating the gui
franxActivated = true
end
if franxActivated == true and (not boySeat.Occupant == "Humanoid" or not boySeat.Occupant == "Humanoid") then
franxActivated = false
end
end
but its not working i wonder how can i tell that the seat is occupied rather than this code
To detect if a seat is occupied, you just have to confirm that the Seat.Occupant does not equal nil.
if Seat.Occupant == nil then
--seat is not occupied
else
--seat is occupied
end
This code that you created won’t work because Seat.Occupant does not equal the string “Humanoid”, when filled, but rather the Humanoid Instance of the user sitting.
Not really necessary because .Occupant should typically always return a Humanoid, but you can also just use Seat.Occupant:IsA(“Humanoid”) to verify it’s a humanoid.