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

Local Script not finding object within its parent?

I'm trying to reference a remote event from a local script, both the script and remote event are stored within the Tool, yet for some reason, I am getting this error " CurrentFuel is not a valid member of Tool "Players.generalYURASKO.Backpack.Lighter" and I don't understand why the script can't find the remote event. I know what a few of you are going to say, "You should keep remote events in replicated storage," but I've done it this way a few times before, and this is the first time I'm seeing this error. Any ideas?

1 comment

1

Try adding in a :WaitForChild() statement to see if that works

1 answer

✓ Accepted answer

To add on what FrontsoldierYT said, the objects that you are trying to get have yet to load. Using the WaitForChild command will make sure that it gets the object as soon as it has loaded

local player = game.Players.LocalPlayer
local lighter = player.Backpack:WaitForChild("Lighter")

1 comment

0

Yea, that did the trick.

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