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

[SOLVED] Trying to Index nill with 'Value'?

I made a very small script to change a value, which in turn changes the camera angle in another script. The problem is this error. I don't know what i did wrong this time, but i hope to get some help here.

The script:

local cameraValues = game.ReplicatedStorage:FindFirstChild("CameraValues")

script.Parent.Touched:Connect(function()
	cameraValues:FindFirstChild("Back").Value = false
	cameraValues:FindFirstChild("Front").Value = true
	cameraValues:FindFirstChild("Side").Value = false
end)

The full error:

19:21:28.378 Workspace.CameraFront.FrontChange:6: attempt to index nil with 'Value' - Server - FrontChange:6

Any help is appreciated!

1 answer

There could be several things causing this error. First, verify in the explorer that "Side" is spelled correctly and is parented to cameraValues as stated in the script. This error is due to the script not finding "Side" under cameraValues.

2 comments

0

I fixed it. not with any code/ names, but with restarting studio. Apparently Studio glitched and showed me the values, but on Studios side, it wasn't there. Thanks for replying anyways!

0

No worries! Good luck with your project!

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