Seat occupant and value are the same,but this is not working

basically im trying to make it so some things like moving camera and opening ui, which i got to work. but i only want this to happen if this value and seat occupant are the same. why isn’t this working?

seat:GetPropertyChangedSignal("Occupant"):Connect(function()
						

				if seat.Occupant ~= nil then
					
					print(owner.Value)					--returning ANoobyPanda
					print(seat.Occupant.Parent.Name)	--returning ANoobyPanda
					
			if owner.Value == seat.Occupant.Parent.Name then
	
						print("the things are the same")-- not coming back
						
				if db == true then
				db = false
				
				--stuff happens

thankss

What kind of value is owner? Is it an ObjectValue?

Yes, owner is an object value.

Change the if statement to if owner.Value.Name == seat.Occupant.Parent.Name then

it worked! thank you, i had no idea you could put a .Name for a value.

The value of an ObjectValue is literally just an object, an instance. Whatever you set the value of the ObjectValue to, it will give you all of the properties of that instance when you access the value of it. It’s the exact same as if you just referred to the object in the workspace through its ancestry.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.