I'm trying to make a script so that when someone jumps out of a vehicle seat, it clears a line on a SurfaceGui. However, it seems to be these two lines that are causing a major issue:
local frame = game.Workspace["ScreenSet"..i].iBusControl.SurfaceGui.Frame:FindFirstChild(script.Parent.plr.Value) frame.Dest.Text = ""
I'm getting the error: 15:13:25.891 - Workspace.Bus.Chasis.VehicleSeat.Script:21: attempt to index local 'frame' (a nil value)
As it says, frame
is "a nil
value".
frame
was computed as the result of :FindFirstChild
.
According to that wiki article,
FindFirstChild returns ... nil if no such child exists
Thus there isn't a child of Frame
that has the name equal to script.Parent.plr.Value
.
To debug this I suggest something like print("name:", script.Parent.plr.Value)
to see what whether or not the value is set correctly.