Cool FPS camera script for horror, fps, adventure games

Hello I was bored so I made a cool FPS camera system.

Usage
Copy the script below and paste it in a localscript in StarterPlayer → StarterPlayerScripts (Doesn’t neccessarily needs to be this directory can be any if it has localscript support.)
And add these attributes to the script:
image

local Camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local HRP = Character:WaitForChild("HumanoidRootPart")
local Head = Character:WaitForChild("Head")
local Hum = Character:WaitForChild("Humanoid")
local UIS = game:GetService("UserInputService")
local RS = game:GetService("RunService")

local CamAngle = Vector2.new(0,0)

local function lerp(a,b,t)
	return a + (b - a) *  t
end

local lastx = CamAngle.X
RS.RenderStepped:Connect(function(dt)
	Camera.CameraType = Enum.CameraType.Scriptable
	UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
	for i,v in pairs(Character:GetDescendants()) do
		if v:IsA("BasePart") then
			v.LocalTransparencyModifier = 1
		end
	end
	local YOffset = math.abs(HRP.Position.Y-Head.Position.Y)
	local rotx = CFrame.Angles(0,math.rad(CamAngle.X),0)
	local roty = CFrame.Angles(math.rad(CamAngle.Y),0,0)
	local ori = CFrame.new(HRP.Position+Vector3.new(0,YOffset,0)) * rotx*roty
	local dir = ori:ToWorldSpace(CFrame.new(0,0,-1))
	local directionalcf = CFrame.new(ori.Position,dir.Position)
	local x,y,z = directionalcf:ToOrientation()
	local bobble = math.sin(tick()*5*Hum.WalkSpeed/16) * HRP.Velocity.Magnitude/script:GetAttribute("BobbleDamp")
	if script:GetAttribute("DoBobble") then
		x += math.abs(bobble)
		y += bobble
	end
	local CF = CFrame.new(HRP.Position+Vector3.new(0,YOffset,0))*CFrame.Angles(-x,-y,-math.rad(math.clamp(lastx-CamAngle.X,-45,45))):Inverse()
	Camera.CFrame = Camera.CFrame:Lerp(CF,dt*script:GetAttribute("Responsiveness"))
	lastx = CamAngle.X
end)

UIS.InputChanged:Connect(function(i,gpe)
	if not gpe then
		if i.UserInputType == Enum.UserInputType.MouseMovement then
			local delta = i.Delta
			local x = CamAngle.X-math.clamp(delta.X,-20,20)
			local y = math.clamp(CamAngle.Y-delta.Y,-89,89)
			CamAngle = Vector2.new(x,y)*UIS.MouseDeltaSensitivity
		end
	end
end)

I just made this for fun : p

  • Nice thanks!
  • Bad.
  • Wow thank you so much for this!

0 voters

46 Likes

lol i love it

2 Likes

wait are you being sarcastic or real?

4 Likes

im being real
(someextrawords)

3 Likes

can you provide a video of the resource?

3 Likes

Cant because my pc is very bad at recording videos and you would be seeing 10 fps gameplay @ 144p

2 Likes

great job for letting me see what’s behind aimuley

2 Likes

So you like to stalk roblox girls? sus. Anyways is that sarcastic? Because I am very uhh idk what to say my anglish sux but yea are you being sarcastic?

1 Like

also who the hell is aimuley. I am not into the roblox community a lot. kind of like the dead guy called @Forummer rip.

2 Likes

weirdo… but okay.

2 Likes

Is there a way to make arms visible?

2 Likes

yes there (just add a table with all arms and a bit of coding at the section where i make all body dissapear) is but it looks weird if your responsiveness is low i would suggest keeping the responsiveness high to like 100 or infinity

2 Likes

aight
image

1 Like

didnt work, im a bad scripter my bad
image

2 Likes
local arms = {
	"Left Arm","Right Arm",
	"Left Upper Arm","Right Upper Arm",
	"Left Lower Arm","Right Lower Arm",
	"Left Hand","Right Hand"
}

a table anywhere you want

	for i,v in pairs(Character:GetDescendants()) do
		if v:IsA("BasePart") and not table.find(arms,v.Name) then
			v.LocalTransparencyModifier = 1
		end
	end

or

	for i,v in pairs(Character:GetDescendants()) do
		if v:IsA("BasePart") and not string.find(v.Name,"Arm") --[[legs,foot,hand etc]] then
			v.LocalTransparencyModifier = 1
		end
	end
3 Likes

Because no one has done one yet, here’s a showcase video with the default parameters that OP set
image

6 Likes

Uh Ackshually people have done that namely 991_12 :nerd_face: Anyways thanks for the video because my potato ah pc can only film vids at 10p@1pHz (p meaning pico). Hope you like it for your… spreading the furry disease game… (Haha just kidding… not really)

3 Likes

yo uhh i cant see tools for some reason.

1 Like

I have 2 functions that you can loop through to make arms visible and invisible whenever you want.

local Connections = {}

local function makeArmsVisible(part)
	if part and part:IsA("BasePart") and(part.Name=="LeftUpperArm"  or part.Name=="LeftLowerArm" or part.Name=="LeftHand" or part.Name=="RightUpperArm" or part.Name=="RightLowerArm" or part.Name=="RightHand" or part.Name=="Left Arm" or part.Name=="Right Arm") then
		part.LocalTransparencyModifier = part.Transparency
		local visibleConnection = part.Changed:Connect(function(property)
			part.LocalTransparencyModifier = part.Transparency
		end)
		table.insert(Connections, visibleConnection)
	end
end

local function makeArmsInvisible(part)
	if part and part:IsA("BasePart") and (part.Name == "LeftUpperArm" or part.Name == "LeftLowerArm" or part.Name == "LeftHand" or part.Name == "RightUpperArm" or part.Name == "RightLowerArm" or part.Name == "RightHand" or part.Name == "Left Arm" or part.Name == "Right Arm") then
		for _, connection in ipairs(Connections) do
			connection:Disconnect()
		end
		part.LocalTransparencyModifier = 1
	end
end

The former obviously makes the arms visible and the latter reverses it. This must be run in a localscript. Here’s an example loop to make the player’s arms visible:

local player = game.Players.LocalPlayer
local character = player.Character

-- put the functions here

for i, v in pairs(character:GetChildren()) do
    makeArmsVisible(v)
end

and if you run the same loop with the makeArmsInsivible function it should work as intended.

this makes me feel drunk… perfect

2 Likes