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

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

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
1
Answered by 3 years ago

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

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! ColdFoxy07 76 — 3y
0
No worries! Good luck with your project! BunnyFilms1 297 — 3y
Ad

Answer this question