So I am making something where the camera type is Attach.
I dont know much about coding a controller to work on ROBLOX, so I just use thus script found on the wiki:
-- Make variables for player, character, and camera local player = game.Players.LocalPlayer while not player.Character do wait() end local character = player.Character local camera = game.Workspace.CurrentCamera -- Update camera rotation every render frame local currentAngle = 0 local deltaAngle = 0 runService.RenderStepped:connect(function() currentAngle = currentAngle + deltaAngle camera.CoordinateFrame = CFrame.new(character.Head.Position) * CFrame.Angles(0, math.rad(currentAngle), 0) * CFrame.new(0, 0, 10) end) -- Check for change event in input. Used for thumbstick input as those are analog userInputService.InputChanged:connect(function(input, processed) if input.UserInputType == Enum.UserInputType.Gamepad1 then -- Check left thumbstick and move character on change if input.KeyCode == Enum.KeyCode.Thumbstick1 then character.Humanoid:Move(Vector3.new(input.Position.X, 0, -input.Position.Y), true) end -- Check right thumbstick and change camera angle on change if input.KeyCode == Enum.KeyCode.Thumbstick2 then deltaAngle = input.Position.X * 5 end end end) -- Check for user input ended events. Handles release of R1 and thumbsticks userInputService.InputEnded:connect(function(input, processed) if input.UserInputType == Enum.UserInputType.Gamepad1 then -- Stop moving character if left thumbstick released if input.KeyCode == Enum.KeyCode.Thumbstick1 then character.Humanoid:Move(Vector3.new(0,0,0)) end -- Stop moving camera if right thumbstick released if input.KeyCode == Enum.KeyCode.Thumbstick2 then deltaAngle = 0 end -- Make character move at normal speed if R1 is released if input.KeyCode == Enum.KeyCode.ButtonR1 then character.Humanoid.WalkSpeed = 16 end end end) -- Check for user input began events. Handles jumping and increasing speed userInputService.InputBegan:connect(function(input, processed) if input.UserInputType == Enum.UserInputType.Gamepad1 then -- If A button is pressed then make the character jump if input.KeyCode == Enum.KeyCode.ButtonA then character.Humanoid.Jump = true end
Near the middle, it shows the code for moving the camera. It wont work with the Attach camera type. Anyone know how to do it?