Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Failed to localise something?

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

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.