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:
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)
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?
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
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
Uh Ackshually people have done that namely 991_12 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)
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.