I was trying to Manipulate the Camera of a Player, when i made it to get fixed on a part it worked, but there was a problem with fixing it back to the Players Humanoid. This is the Code i used:
local Button = script.Parent
function close()
if script.Parent.Value.Value == false then
script.Parent.Value.Value = true
script.Parent.Parent.Parent.LocalScript.Value.Value = false
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"
end
end
Button.MouseButton1Click:connect(close)
Magically in Studio is working fine but when i run the code in Roblox Player it does not work, it just stops the camera where it is and does not moves it to the Player
The Developer Console says the following: Players.lehel55.PlayerGui.ScreenGui.Test.Script:9: attempt to index field 'LocalPlayer' (a nil value)
But the Player can be moved using WASD, just the camera is not moving or can't be movable

1 comment
Are you certain this is a LocalScript, and not a Script?