I want to choose a seat from studentSeats
, but for some reason it is returning StudentSeatValue
,
which is not a member of studentSeats
.
local StudentSeatValue:ObjectValue = player.StudentSeatValue--get student seat value
local seat = studentSeats[#studentSeats]
studentSeats[#studentSeats] = nil
print(seat)
StudentSeatValue.Value = seat
print(StudentSeatValue.Value)
studentHumanoid.JumpPower = 0
seat:Sit(studentHumanoid) --lock player into seat
It should not be possible if it can be assumed that you have structured studentSeats
properly? Could it be possible that studentSeats
has gaps in it’s indices?
1 Like
I’m really stumped on this tbh, but here’s his original code if it helps at all, but I still feel pretty lost to what could be causing the issue. While true do statement randomly pausing, plus other bugs
If a seat is used, the seat is stored in a variable and its value becomes nil.
I’ve also tried defining StudentSeatValue
after the line where seat:Sit()
is called, but the error still shows up.
Guys, it turns out that in the logic that added a student’s seat back into studentSeats
, I was adding StudentSeatValue
instead of StudentSeatValue.Value
.
1 Like
I feel like you should mark my response as a solution, since the issue was really that you did not structure studentSeats
properly