Okay so, you're doing it right, the problem is that you are putting script.Parent.Seat.Occupant INTO the string and you didn't escape it, so you have to escape it.
while true do
wait(0.1)
script.Parent.Value.Value = script.Parent.Seat.Occupant
end
So that should be it right? Well, no, EGGValue.Script will error, why? It will error because you're concatening an userdata, so you have to use.Name
while true do
wait(0.1)
script.Parent.Value.Value = script.Parent.Seat.Occupant.Name
end
Done! Or is it? Now it works, but the problem is that it may say "Humanoid", am i right? That's because when you seat the Occupant property is going to be the humanoid of the character so you'll have to use .Parent on it
while true do
wait(0.1)
script.Parent.Value.Value = script.Parent.Seat.Occupant.Parent.Name
end
But it can be nil too! In this case we have to make another variable called OccupantName, if it doesn't find an occupant it'll be changed to ""
So this is the final code
while true do
wait(0.1)
local OccupantName = script.Parent.Seat.Occupant or ""
if OccupantName ~= "" then
OccupantName = OccupantName.Parent.Name
end
script.Parent.Value.Value = OccupantName
end
If this helped, mark this as the answer!
1 comment
DominicMrKiwi#6864 if you need me. I'm going to check this in the morning, sorry.