The script is supposed to reset the camera and the controls when the gameStarted intValue is 1,
there is a countdown that counts 30 seconds and once it passes the value of gameStarted is 1,
but when i run the script to free the camera and the controls, i keep getting this error and the script cuts off at line 4.
local PlayerModule = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")) local Controls = PlayerModule:GetControls() local gameStarted = game.ReplicatedStorage:WaitForChild("gameStarted") script.Parent.MouseButton1Click:Connect() if gameStarted.Value == 1 then Controls:Enable() workspace.CurrentCamera.FieldOfView = 50 game.Players.LocalPlayer.CameraMode = 'LockFirstPerson' end
✓ ANSWER ACCEPTED
How could i fix "attempt to call a nil value"?
1 answer
✓ Accepted answer
hi, hope this work
local PlayerModule = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerModule:GetControls()
local gameStarted = game.ReplicatedStorage:WaitForChild("gameStarted")
script.Parent.MouseButton1Click:Connect(function()
if gameStarted.Value == 1 then
Controls:Enable() workspace.CurrentCamera.FieldOfView = 50
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
You need to explain what did u do to fix it, -1 for u...jk I am a nice person
Basically what he did it the user asking the question forgot to add local on the gameStarted variable
hi
Thank you so much!