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

Failed to localise something?

Asked by 9 years ago

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)

1 answer

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

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 Framethat 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.

Ad

Answer this question