Add the two scripts together and add a look back funtion for q and e for left and right…
- User
Add the two scripts together and add a look back funtion for q and e for left and right
-- Improved First-Person Camera Script --
-- Place in StarterGui or StarterPack -- -- Credit: -- -- EvelienSterk, SawyerDGamer, iytgggggg, and others contributing to base script -- -- Update: Shows body but hides head and hair, includes smooth controls --
-- Services local runService = game:GetService("RunService") local input = game:GetService("UserInputService") local players = game:GetService("Players")
-- Configuration local CanToggleMouse = {allowed = true, activationkey = Enum.KeyCode.F} -- Toggle mouse movement in first-person local CanViewBody = true -- Whether body is visible local Sensitivity = 0.2 -- Mouse sensitivity local Smoothness = 0.05 -- Smoothness factor for camera movement local FieldOfView = 90 -- Field of view for the camera
-- Initial Setup local cam = game.Workspace.CurrentCamera local player = players.LocalPlayer local m = player:GetMouse() m.Icon = "http://www.roblox.com/asset/?id=569021388" -- Custom mouse icon local character = player.Character or player.CharacterAdded:Wait() local humanoidPart = character:WaitForChild("HumanoidRootPart") local head = character:WaitForChild("Head")
-- Camera Position Variables local CamPos, TargetCamPos = cam.CFrame.Position, cam.CFrame.Position local AngleX, TargetAngleX = 0, 0 local AngleY, TargetAngleY = 0, 0
-- Control Variables local running = true local freemouse = false
-- Updates the character's visibility for first-person mode local function updateCharacterVisibility() for _, part in pairs(character:GetChildren()) do if CanViewBody then if part:IsA("Part") or part:IsA("MeshPart") or part:IsA("UnionOperation") then part.LocalTransparencyModifier = (part.Name == "Head") and 1 or 0 part.CanCollide = false end end
-- Make hair and accessories invisible in first-person if part:IsA("Accessory") then local handle = part:FindFirstChild("Handle") if handle then handle.LocalTransparencyModifier = 1 handle.CanCollide = false end endend end
-- Handle mouse movement for smooth camera controls input.InputChanged:Connect(function(inputObject) if inputObject.UserInputType == Enum.UserInputType.MouseMovement then local delta = Vector2.new(inputObject.Delta.x / Sensitivity, inputObject.Delta.y / Sensitivity) * Smoothness TargetAngleX = math.clamp(TargetAngleX - delta.y, -80, 80) TargetAngleY = (TargetAngleY - delta.x) % 360 end end)
-- Handle keyboard input to toggle mouse lock input.InputBegan:Connect(function(inputObject) if inputObject.UserInputType == Enum.UserInputType.Keyboard and inputObject.KeyCode == CanToggleMouse.activationkey then freemouse = not freemouse end end)
-- Main update loop for the camera and character orientation runService.RenderStepped:Connect(function() if running then updateCharacterVisibility()
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.