Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to change Textlabel's text to seat occupant?

Asked by 2 years ago
Edited 2 years ago

I made a chair and I want that a text label shows the seat's occupant. Sorry for the grammar (I used google translate)

-- Serverscript
textlabel = script.Parent.Parent.NameLabel
Seat = script.Parent.Parent.Parent.Parent.Bench.Seat
while true do
wait(0.1)
textlabel.Text = game.Players:GetPlayerFromCharacter(Seat.Occupant.parent)
end

and it says ' text is not a valid member of TextLabel "TextLabel" '

1 answer

Log in to vote
0
Answered by 2 years ago
textlabel.Text=game.Players:GetPlayerFromCharacter(Seat.Occupant.parent.Name)

instead of

textlabel.Text = game.Players:GetPlayerFromCharacter(Seat.Occupant.parent)

Your script was setting textlabel.Text to the occupant itself

Ad

Answer this question