I am making a 2D game and am trying to change the position of my camera when a value is changed although it doesn't seem to be working?
local player = game.Players.LocalPlayer local camera = workspace.CurrentCamera local Left = script.Left player.CharacterAdded:Wait() player.Character:WaitForChild("HumanoidRootPart") camera.CameraSubject = player.Character.HumanoidRootPart camera.CameraType = Enum.CameraType.Attach camera.FieldOfView = 70 camera.CFrame = CFrame.new(Left,10,10) Left.Changed:Connect(function() player.CharacterAdded:Wait() player.Character:WaitForChild("HumanoidRootPart") camera.CameraSubject = player.Character.HumanoidRootPart camera.CameraType = Enum.CameraType.Attach camera.FieldOfView = 70 camera.CFrame = CFrame.new(Left,10,10) end)
I get this error "Players.zomspi.PlayerScripts.CameraScript:17: attempt to index field 'Value' (a number value)"
My updated script
local player = game.Players.LocalPlayer local camera = workspace.CurrentCamera local Left = script.Left player.CharacterAdded:Wait() player.Character:WaitForChild("HumanoidRootPart") camera.CameraSubject = player.Character.HumanoidRootPart camera.CameraType = Enum.CameraType.Attach camera.FieldOfView = 70 camera.CFrame = CFrame.new(Left,10,10) Left.Value.Changed:Connect(function() player.CharacterAdded:Wait() player.Character:WaitForChild("HumanoidRootPart") camera.CameraSubject = player.Character.HumanoidRootPart camera.CameraType = Enum.CameraType.Attach camera.FieldOfView = 70 camera.CFrame = CFrame.new(Left.Value,10,10) end)
Thanks for the help though!