Transparency not working?

I created this normal script but it ain’t working? any toughts?

if DriverSeat.Occupant==“Humanoid” then

DriverHUD.Transparency=1

elseif DriverSeat.Occupant then

DriverHUD.Transparency=0

end

1 Like

You need to reference the location of the “DriverSeat” and “DriverHUD” properties.

2 Likes

here is the full script I made:

local SoundBase=script.Parent.Parent.BodyKit.SoundEscape
local DriverSeat=script.Parent.DriverSeat
local DriverHUD=script.Parent.DriverHUD
local PassengerSeat=script.Parent.PassengerSeat
local PassengerHUD=script.Parent.PassengerHUD

PassengerHUD.click.MouseClick:connect(function(plr)
if PassengerSeat.Occupant then
PassengerHUD.click.MaxActivationDistance=0
SoundBase.MetalDoorSlam:Play()return end --play sound if human in seat
local char=plr.Character
if not char then return end
local humanoid=char:FindFirstChildOfClass(“Humanoid”)
if not humanoid then return end
SoundBase.MetalDoorOpen:Play()
PassengerSeat:Sit(humanoid)
end)

DriverHUD.click.MouseClick:connect(function(plr)
if PassengerSeat.Occupant then
DriverHUD.click.MaxActivationDistance=0
SoundBase.MetalDoorSlam:Play()return end --play sound if human in seat
local char=plr.Character
if not char then return end
local humanoid=char:FindFirstChildOfClass(“Humanoid”)
if not humanoid then return end
SoundBase.MetalDoorOpen:Play()
DriverSeat:Sit(humanoid)
end)
if DriverSeat.Occupant==“Humanoid” then
DriverHUD.Transparency=1
elseif DriverSeat.Occupant then
DriverHUD.Transparency=0
end

1 Like

What part is not working and what are you trying to achieve?

2 Likes

That when I click the brick, it moves me to the seat, and then the brick that I clicked dissapear

1 Like
if DriverSeat.Occupant==“Humanoid” then

and

elseif DriverSeat.Occupant then

are both true, since the if statement is really just checking to make sure it’s not nil or 0, so they’re both trying to be set.
but because the elseif is at the bottom, the transparency would always be 0.

1 Like

Wait, am not too skilled at scripting, but shouldn’t be like this
… Occupant == “Humanoid”…
I mean the spaces in the if statement.

Or maybe i don’t know what am talking about because am not great at scripting.

1 Like