Hello, I have this code I made for a helmet camera, similar to a go-pro. The issue is that, well when I equip a gun, it doesnt make my camera move too. Here’s the code:
Client:
local players = game:GetService("Players")
local runservice = game:GetService("RunService")
local userinputservice = game:GetService("UserInputService")
local localplayer = players.LocalPlayer
local character = localplayer.Character or localplayer.CharacterAdded:Wait()
local currentcamera = workspace.CurrentCamera
local helmet = character:WaitForChild("NatoHelmet")
userinputservice.MouseBehavior = Enum.MouseBehavior.LockCenter
repeat task.wait()
currentcamera.CameraType = Enum.CameraType.Scriptable
until currentcamera.CameraType == Enum.CameraType.Scriptable
runservice.RenderStepped:Connect(function(dt)
currentcamera.CFrame = helmet.Handle.CFrame * CFrame.Angles(0,math.rad(180),0) * CFrame.new(0.9,-0.2,0)
end)
- The only current way I can move is using WASD, so moving using the mouse would be preferred.