Advertisement
CsgoUser

Lock first peron script roblox

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