it might be a stupid error but every time i press a key my camera changes the problem is that i assigned g as the key and for some reason any button i press it runs the code and i'm not sure why here is the code.
buttonPressed = false
mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:connect(function(key)
buttonPressed = true
if key == "g" then
end
end)
mouse.KeyUp:connect(function(key)
buttonPressed = false
if key == "g" then
end
while wait() do
if buttonPressed then
local target = workspace.Part
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
camera.CoordinateFrame = CFrame.new(target.Position)
*CFrame.new(2.9,4.6,-22)
*CFrame.Angles(0,-3.1,0)
else
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"
end
end
end)
