Billboard text not changing

Hello. I have a script that lets the player owns the vehicle once they hop in.
It works, except for this part:

script.Parent.OwnVehicle.Occupant:GetPropertyChangedSignal("Value"):Connect(function()
	if script.Occupant.Value == "NoOccupant" then
		for _, billboard in pairs(script.Parent:GetDescendants()) do
			if billboard.Name == "OccupantGui" then
				billboard.TextLabel.Text = "Vacant Vehicle"
				print("no occupant")
			end
		end
	end
end)

The occupant UI is clearly there, idk why it won’t change.
image
The despawn timer (which is in the same chunk) works however.

3 Likes

Try using WaitForChild() on the TextLabel for the billboard gui

Doesn’t work, same result.

EDIT: seems like its skipping it for some reason


(this is the same timeframe i triggered it)

can you show the whole explorer screenshot of exactly were the base part is located

image

Does the getpropertychangedsignal trigger.Try adding a print statement before the if statement

I’m pretty sure you just forgot to write the other if-statement. In your code, I only see you checking if there is no occupant in your vehicle:

if script.Occupant.Value == "NoOccupant" then

But no code runs if there is an occupant!

initially he should have text still even without an occupant

Yes, it does trigger.
image

Atleast the despawn UI.

I don’t quite get it: what are you trying to accomplish? How are you getting the vehicle’s code to trigger? Can you send me your full code and what you’re trying to do with it?

The code you provided for despawngui ensures its enabled try that for OccupantGui

This chunk of code vacates the vehicle when it’s owner dies/leaves, or if owner claims a vehicle over the limit.
Here is another part of the code, which detects if there is an occupant in the seat.

and yeah still same result as before

1 Like

What are you doing to try to get the billboardgui to change? Are you hopping into the vehicle? Hopping out of it? Dying?

1 Like

Dying/leaving/exceeding the vehicle owned limit

I noticed an issue: in plrLeaving, you disconnect from deathConnection rather than plrLeaving. Not the root of your issues, but a problem nonetheless.

Are there any errors? What exactly is calling OwnVehicle()? What is vs.Occupant? Why are you setting the script’s parent’s parent to workspace when they leave or die?

Also, when you set the billboard text, if the player doesn’t have a displayname, you use occupant.Parent.Name, but if they do you use occupant.DisplayName? Where did the extra parent come from in the first if?

When the player sits in the vehicle while its vacant.

The occupant property of the actual vehicleseat itself.

The vehicle is parented to a folder with the player’s name once they own it (for limiting reasons), which is parented to another folder.

The occupant property of a vehicle seat is not a string it’s the humanoid of the player who is sitting

Do this instead:

if script.Occupant.Value ~= nil then

ok yeah uhh
image

I have a string value with the name “Occupant” (hence why there is Occupant.Value and not vs.Occupant)