Not a valid member of Frame

I’m trying to make a self check-in thing.

The code usually works well but all of a sudden i get the error:

ArrivalTimeTxt is not a valid member of Frame "FlightInfo" 

My script:

game.ReplicatedStorage.SCI.RE.FlightInfo.OnClientEvent:Connect(function(arrival, departure, destination, boarding,gate, aircraft,flightnum,class1,class2,class3,class4)
	--for _, FlightInfoFramePart in pairs(FlightInfo:GetChildren() ) do
	--	print(FlightInfoFramePart.Name)
	--end
	FlightInfo.ArrivalTimeTxt.Text = arrival
	FlightInfo.DepTimeTxt.Text = departure
	FlightInfo.DestTxt.Text = destination
	FlightInfo.BoarTimeTxt.Text = boarding
	FlightInfo.GateNum.Text = gate
	FlightInfo.AircraftTxt.Text = aircraft
	FlightInfo.FlightNum.Text = flightnum
	BookingFrame.Class1Seats.Text = "Remaining Seats: "..class1
	BookingFrame.Class2Seats.Text = "Remaining Seats: "..class2
	BookingFrame.Class3Seats.Text = "Remaining Seats: "..class3
	BookingFrame.Class4Seats.Text = "Remaining Seats: "..class4
end)

Yes the frame does exist and I have not named anything wrong. It all should work. So i’m not familiar to why? The error occurs when I try changing the flightInfo in a gui. Usually everything works.

Does anyone know a fix?

2 Likes

Use WaitForChild on the frame as it can take some time to load the frame. Do this for all the different instances from FlightInfo. If this also happens with BookingFrame, use WaitForChild on that as well:

FlightInfo:WaitForChild("ArrivalTimeTxt").Text = arrival

https://developer.roblox.com/en-us/api-reference/function/Instance/WaitForChild

4 Likes

Thank you for the help! Didn’t know it was that simple! And thanks for the tips!

2 Likes

I’d create a for loop for some of this, just so you can clean up your code a bit. Or a function. It’s a little messy at the moment

1 Like