Advertisement
Anukun_Lucifer

FirstPersonScript

Oct 29th, 2022
11,495
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | Source Code | 1 0
  1. local player = game.Players.LocalPlayer
  2. local char = player.Character
  3. local RunService = game:GetService("RunService")
  4.  
  5. char.Humanoid.CameraOffset = Vector3.new(0,0, -1)
  6.  
  7. for i, v in pairs(char:GetChildren()) do
  8.     if v:IsA("BasePart") and v.Name ~= "Head" then
  9.  
  10.         v:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
  11.             v.LocalTransparencyModifier = v.Transparency
  12.         end)
  13.  
  14.         v.LocalTransparencyModifier = v.Transparency
  15.  
  16.     end
  17. end
  18.  
  19. RunService.RenderStepped:Connect(function(step)
  20.     local ray = Ray .new(char.Head.Position, ((char.Head.CFrame + char.Head.CFrame.LookVector * 2) - char.Head.Position).Position.Unit)
  21.     local ignoreList = char:GetChildren()
  22.  
  23.     local hit, pos = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)
  24.  
  25.     if hit then
  26.         char.Humanoid.CameraOffset = Vector3.new(0, 0, -(char.Head.Position - pos).magnitude)
  27.     else
  28.         char.Humanoid.CameraOffset = Vector3.new(0, 0, -1)
  29.     end
  30. end)
Tags: Roblox Doors
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement