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

Script gives a nil value warning?

In my game, it gives me a warning Workspace.Admin:2: attempt to index field 'Parent' (a nil value)

local GUI = script.Parent.Parent;
local player = GUI.Parent.Parent;
local user = player.Character;
local cam = workspace.CurrentCamera;

I hope that someone could help me.

1 comment

0

whats the parent of this script,

1 answer

✓ Accepted answer

If you are using a local script, instead of defining the player by GUI.Parent.Parent, define the player as a LocalPlayer, and I see that on line 3 of your's, you're defining the player's character. What if the player's character was never loaded?

local player = game.Players.LocalPlayer
local character = player.CharacterAdded:Wait() or player.Character

2 comments

0

Since you didn't provide enough details, I couldn't help you out any further. Please make sure you include the details of your answer when posting

2

:dab:

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