Helmet Camera Resource (R15,R6)

Hello some of you have probably seen a popular spike in leaked footage games, I have made a simple helmet script for your games!!!

--r15
local camera = game.Workspace.Camera

local Players = game:GetService("Players")

local Rs = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local CS = game:GetService("ContextActionService")

local Player = Players.LocalPlayer
local Charecter:Model = Player.Character
local Head:Part = Charecter:WaitForChild("Head")
local Torso:Part = Charecter:WaitForChild("UpperTorso")
local Neck:Motor6D = Head:WaitForChild("Neck")
local Humanoid:Humanoid = Charecter:WaitForChild("Humanoid")
local HumanoidRootPart:Part = Charecter:WaitForChild("HumanoidRootPart")
local Mouse = Player:GetMouse()

Humanoid.AutoRotate = false

local Dead = false


camera.CameraType = Enum.CameraType.Scriptable
camera.FieldOfView = 120



local Offfset = 1.2 --Mess With this value the more you add to this number it becomes oriented to the right if negative oriented to the left
local currentxoffset = Offfset

local HelmetPositonLoop
local InputConnection
local MouseConneciton

HelmetPositonLoop = Rs.RenderStepped:Connect(function()

	camera.CFrame = (Head.CFrame * CFrame.new(Vector3.new(currentxoffset, 0.5, 0.6)))
	UIS.MouseBehavior = Enum.MouseBehavior.LockCenter


end)

local CurrentXDelta = 0
local CurrentYDelta = 0
local NeckCahce = Neck.C0
function MouseMoved(actionName:string, inputState, inputObject:InputObject)

	local Neckc0Store:CFrame = Neck.C0

	local CompressedDelta:Vector2 = Vector2.new(inputObject.Delta.X,inputObject.Delta.Y)

	CurrentXDelta = CompressedDelta.X
	CurrentYDelta = CompressedDelta.Y

	HumanoidRootPart.CFrame = HumanoidRootPart.CFrame:Lerp(HumanoidRootPart.CFrame * CFrame.Angles(0, -math.rad(CurrentXDelta/2), 0),1) 	

	local RotationX, RotationY, RotationZ = Neckc0Store:ToEulerAnglesXYZ()

	local NewRotX =    math.deg(RotationX+ -CurrentYDelta/200)



	NewRotX = math.clamp(NewRotX,-85,65)

	Neck.C0 = Neck.C0:Lerp(CFrame.new(Neckc0Store.Position)*CFrame.Angles(math.rad(NewRotX),RotationY,RotationZ),1) 




end

MouseConneciton = CS:BindAction("MouseMoved",MouseMoved,false,Enum.UserInputType.MouseMovement)

InputConnection = UIS.InputBegan:Connect(function(input:InputObject,GPE:boolean)

	if GPE then return end

	local Keycode = input.KeyCode


	if Keycode == Enum.KeyCode.Q and currentxoffset ~= -Offfset then

		currentxoffset = -Offfset
	end
	if Keycode == Enum.KeyCode.E and currentxoffset ~= math.abs(Offfset) then
		currentxoffset = math.abs(Offfset)

	end
	--print(currentxoffset)

end)

Humanoid.Died:Connect(function()
	if Dead == true then return end

	Dead = true
	InputConnection:Disconnect()

	CS:UnbindAction("MouseMoved")

	task.wait(Players.RespawnTime)

	HelmetPositonLoop:Disconnect()

end)

--R6
local camera = game.Workspace.Camera

local Players = game:GetService("Players")

local Rs = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local CS = game:GetService("ContextActionService")

local Player = Players.LocalPlayer
local Charecter:Model = Player.Character
local Head:Part = Charecter:WaitForChild("Head")
local Torso:Part = Charecter:WaitForChild("Torso")
local Neck:Motor6D = Torso:WaitForChild("Neck")
local Humanoid:Humanoid = Charecter:WaitForChild("Humanoid")
local HumanoidRootPart:Part = Charecter:WaitForChild("HumanoidRootPart")
local Mouse = Player:GetMouse()

Humanoid.AutoRotate = false

local Dead = false


camera.CameraType = Enum.CameraType.Scriptable
camera.FieldOfView = 120



local Offfset = 1.2 --Mess With this value the more you add to this number it becomes oriented to the right if negative oriented to the left
local currentxoffset = Offfset

local HelmetPositonLoop
local InputConnection
local MouseConneciton

HelmetPositonLoop = Rs.RenderStepped:Connect(function()
	
	camera.CFrame = (Head.CFrame * CFrame.new(Vector3.new(currentxoffset, 0.5, 0.6)))
	UIS.MouseBehavior = Enum.MouseBehavior.LockCenter

	
end)

local CurrentXDelta = 0
local CurrentYDelta = 0
local NeckCahce = Neck.C0
function MouseMoved(actionName:string, inputState, inputObject:InputObject)
	
	local Neckc0Store:CFrame = Neck.C0

	local CompressedDelta:Vector2 = Vector2.new(inputObject.Delta.X,inputObject.Delta.Y)
	
	CurrentXDelta = CompressedDelta.X
	CurrentYDelta = CompressedDelta.Y

	HumanoidRootPart.CFrame = HumanoidRootPart.CFrame:Lerp(HumanoidRootPart.CFrame * CFrame.Angles(0, -math.rad(CurrentXDelta/2), 0),1) 	
	
	local RotationX, RotationY, RotationZ = Neckc0Store:ToEulerAnglesXYZ()
	
	local NewRotX =    math.deg(RotationX+ -CurrentYDelta/200)
	
	
	
	NewRotX = math.clamp(NewRotX,-160,-10)
	
	Neck.C0 = Neck.C0:Lerp(CFrame.new(Neckc0Store.Position)*CFrame.Angles(math.rad(NewRotX),RotationY,RotationZ),1) 
	
	

	
end

MouseConneciton = CS:BindAction("MouseMoved",MouseMoved,false,Enum.UserInputType.MouseMovement)
	
InputConnection = UIS.InputBegan:Connect(function(input:InputObject,GPE:boolean)
	
	if GPE then return end
	
	local Keycode = input.KeyCode
	
	
	if Keycode == Enum.KeyCode.Q and currentxoffset ~= -Offfset then
		
		currentxoffset = -Offfset
	end
	if Keycode == Enum.KeyCode.E and currentxoffset ~= math.abs(Offfset) then
		currentxoffset = math.abs(Offfset)

	end
	--print(currentxoffset)
	
end)

Humanoid.Died:Connect(function()
	if Dead == true then return end
	
	Dead = true
	InputConnection:Disconnect()

	CS:UnbindAction("MouseMoved")

	task.wait(Players.RespawnTime)
	
	HelmetPositonLoop:Disconnect()
	
end)

AS always have fun!

4 Likes

These look cool, is there any chest style scripts?

Yeah its very possbile do you also want the chest camera to move on the y axis too? i can modify this one real quick

Yes please, that would work great

I somewhat forgot about this post im quite sorry but i have made some code YIPEE 11!1!

Heres a vid (of it working Short vid because of roblox’s 10 mb restrictions :sob: ):

Heres the code:

local camera = game.Workspace.Camera

local Players = game:GetService("Players")

local Rs = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local CS = game:GetService("ContextActionService")

local Player = Players.LocalPlayer
local Charecter:Model = Player.Character



local Head:Part = Charecter:WaitForChild("Head")
local Torso:Part = Charecter:WaitForChild("Torso")
local Humanoid:Humanoid = Charecter:WaitForChild("Humanoid")
local HumanoidRootPart:Part = Charecter:WaitForChild("HumanoidRootPart")


local Neck:Motor6D = Torso:WaitForChild("Neck")
local RootPart:Part = Charecter:WaitForChild("HumanoidRootPart")
local Waist:Motor6D = RootPart:WaitForChild("RootJoint")
local LHip:Motor6D = Torso:WaitForChild("Left Hip")
local RHip:Motor6D = Torso:WaitForChild("Right Hip")


local Mouse = Player:GetMouse()

Humanoid.AutoRotate = false

local Dead = false


camera.CameraType = Enum.CameraType.Scriptable
camera.FieldOfView = 120



local Offfset = 0 --Mess With this value the more you add to this number it becomes oriented to the right if negative oriented to the left
local currentxoffset = Offfset

local HelmetPositonLoop
local InputConnection
local MouseConneciton

HelmetPositonLoop = Rs.RenderStepped:Connect(function()

	camera.CFrame = (Torso.CFrame * CFrame.new(Vector3.new(currentxoffset, 0.5, -0.6)))
	UIS.MouseBehavior = Enum.MouseBehavior.LockCenter


end)

local CurrentXDelta = 0
local CurrentYDelta = 0


local NeckCahce = Neck.C0
local WaistCahce = Waist.C0
local LHipCahce = LHip.C0
local RHipCahce = RHip.C0

function MouseMoved(actionName:string, inputState, inputObject:InputObject)

	local Neckc0Store:CFrame = Neck.C0
	local Waistc0Store:CFrame = Waist.C0
	
	local CompressedDelta:Vector2 = Vector2.new(inputObject.Delta.X,inputObject.Delta.Y)

	CurrentXDelta = CompressedDelta.X
	CurrentYDelta = CompressedDelta.Y

	HumanoidRootPart.CFrame = HumanoidRootPart.CFrame:Lerp(HumanoidRootPart.CFrame * CFrame.Angles(0, -math.rad(CurrentXDelta/2), 0),1) 	

	local NeckRotationX, NeckRotationY, NeckRotationZ = Neckc0Store:ToEulerAnglesXYZ()
	
	
	local ChestRotationX, ChestRotationY, ChestRotationZ = Waistc0Store:ToEulerAnglesXYZ()

	
	local NewRotXNeck =    math.deg(NeckRotationX+ -CurrentYDelta/150)



	NewRotXNeck = math.clamp(NewRotXNeck,-140,-10)
	

	local NewRotXChest =    math.deg(ChestRotationX+ -CurrentYDelta/200)



	NewRotXChest = math.clamp(NewRotXChest,-160,-10)
	
	local CounterLeg = Waist.C0*WaistCahce:Inverse()

	local CounterLegCf = CounterLeg:Inverse()
	
	
	Neck.C0 = Neck.C0:Lerp(CFrame.new(Neckc0Store.Position)*CFrame.Angles(math.rad(NewRotXNeck),NeckRotationY,NeckRotationZ),1) 
	Waist.C0 = Waist.C0:Lerp(CFrame.new(Waistc0Store.Position)*CFrame.Angles(math.rad(NewRotXChest),ChestRotationY,ChestRotationZ),1) 

	RHip.C0 =  CounterLegCf*LHipCahce
	LHip.C0 = CounterLegCf*RHipCahce
	


end

MouseConneciton = CS:BindAction("MouseMoved",MouseMoved,false,Enum.UserInputType.MouseMovement)

InputConnection = UIS.InputBegan:Connect(function(input:InputObject,GPE:boolean)

	if GPE then return end

	local Keycode = input.KeyCode

	

	if Keycode == Enum.KeyCode.Q and currentxoffset ~= -Offfset then

		currentxoffset = -Offfset
	end
	if Keycode == Enum.KeyCode.E and currentxoffset ~= math.abs(Offfset) then
		currentxoffset = math.abs(Offfset)

	end
	--print(currentxoffset)

end)

Humanoid.Died:Connect(function()
	if Dead == true then return end

	Dead = true
	InputConnection:Disconnect()

	CS:UnbindAction("MouseMoved")

	task.wait(Players.RespawnTime)

	HelmetPositonLoop:Disconnect()

end)

I found a bug in the code its fixed here now

local camera = game.Workspace.Camera

local Players = game:GetService("Players")

local Rs = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local CS = game:GetService("ContextActionService")

local Player = Players.LocalPlayer
local Charecter:Model = Player.Character



local Head:Part = Charecter:WaitForChild("Head")
local Torso:Part = Charecter:WaitForChild("Torso")
local Humanoid:Humanoid = Charecter:WaitForChild("Humanoid")
local HumanoidRootPart:Part = Charecter:WaitForChild("HumanoidRootPart")


local Neck:Motor6D = Torso:WaitForChild("Neck")
local RootPart:Part = Charecter:WaitForChild("HumanoidRootPart")
local Waist:Motor6D = RootPart:WaitForChild("RootJoint")
local LHip:Motor6D = Torso:WaitForChild("Left Hip")
local RHip:Motor6D = Torso:WaitForChild("Right Hip")


local Mouse = Player:GetMouse()

Humanoid.AutoRotate = false

local Dead = false


camera.CameraType = Enum.CameraType.Scriptable
camera.FieldOfView = 120



local Offfset = 0 --Mess With this value the more you add to this number it becomes oriented to the right if negative oriented to the left
local currentxoffset = Offfset

local HelmetPositonLoop
local InputConnection
local MouseConneciton

HelmetPositonLoop = Rs.RenderStepped:Connect(function()

	camera.CFrame = (Torso.CFrame * CFrame.new(Vector3.new(currentxoffset, 0.5, -0.6)))
	UIS.MouseBehavior = Enum.MouseBehavior.LockCenter


end)

local CurrentXDelta = 0
local CurrentYDelta = 0


local NeckCahce = Neck.C0
local WaistCahce = Waist.C0
local LHipCahce = LHip.C0
local RHipCahce = RHip.C0
--local rep = game.ReplicatedStorage.Motor
function MouseMoved(actionName:string, inputState, inputObject:InputObject)

	local Neckc0Store:CFrame = Neck.C0
	local Waistc0Store:CFrame = Waist.C0
	
	local CompressedDelta:Vector2 = Vector2.new(inputObject.Delta.X,inputObject.Delta.Y)

	CurrentXDelta = CompressedDelta.X
	CurrentYDelta = CompressedDelta.Y

	HumanoidRootPart.CFrame = HumanoidRootPart.CFrame:Lerp(HumanoidRootPart.CFrame * CFrame.Angles(0, -math.rad(CurrentXDelta/2), 0),1) 	

	local NeckRotationX, NeckRotationY, NeckRotationZ = Neckc0Store:ToEulerAnglesXYZ()
	
	
	local ChestRotationX, ChestRotationY, ChestRotationZ = Waistc0Store:ToEulerAnglesXYZ()

	
	local NewRotXNeck =    math.deg(NeckRotationX+ -CurrentYDelta/150)



	NewRotXNeck = math.clamp(NewRotXNeck,-140,-10)
	

	local NewRotXChest =    math.deg(ChestRotationX+ -CurrentYDelta/200)



	NewRotXChest = math.clamp(NewRotXChest,-160,-10)
	

	
	Neck.C0 = Neck.C0:Lerp(CFrame.new(Neckc0Store.Position)*CFrame.Angles(math.rad(NewRotXNeck),NeckRotationY,NeckRotationZ),1) 
	Waist.C0 = Waist.C0:Lerp(CFrame.new(Waistc0Store.Position)*CFrame.Angles(math.rad(NewRotXChest),-ChestRotationY,ChestRotationZ),1) 

	
	local CounterLeg = Waist.C0*WaistCahce:Inverse()

	local CounterLegCf = CounterLeg:Inverse()

	
	RHip.C0 =  CounterLegCf*RHipCahce
	LHip.C0 = CounterLegCf*LHipCahce

	
	--rep:FireServer(Neck,Neck.C0)

	--rep:FireServer(Waist,Waist.C0)
	
	--rep:FireServer(RHip,RHip.C0)
	
	--rep:FireServer(LHip,RHip.C0)

	
end

MouseConneciton = CS:BindAction("MouseMoved",MouseMoved,false,Enum.UserInputType.MouseMovement)

InputConnection = UIS.InputBegan:Connect(function(input:InputObject,GPE:boolean)

	if GPE then return end

	local Keycode = input.KeyCode

	

	if Keycode == Enum.KeyCode.Q and currentxoffset ~= -Offfset then

		currentxoffset = -Offfset
	end
	if Keycode == Enum.KeyCode.E and currentxoffset ~= math.abs(Offfset) then
		currentxoffset = math.abs(Offfset)

	end
	--print(currentxoffset)

end)

Humanoid.Died:Connect(function()
	if Dead == true then return end

	Dead = true
	InputConnection:Disconnect()

	CS:UnbindAction("MouseMoved")

	task.wait(Players.RespawnTime)

	HelmetPositonLoop:Disconnect()

end)

Yo that looks awesome! Thank you so much!

2 Likes