Advertisement
Lazzzycat1

FPScamv2

Jan 2nd, 2025
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.23 KB | None | 0 0
  1. local config = require(game:GetService("ReplicatedStorage").SPH_Assets.GameConfig)
  2. if not config.firstPersonBody then return end
  3. local Character = script.Parent.Parent
  4. local RunService = game:GetService("RunService")
  5. local Humanoid = Character:WaitForChild("Humanoid")
  6. local Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
  7. local dead, vehicleSeated, gunEquipped = false, false, nil
  8. Humanoid.Died:Connect(function() dead = true end)
  9. Humanoid.Seated:Connect(function(seated, seatPart) vehicleSeated = seated and seatPart:IsA("VehicleSeat") end)
  10. local function CheckForBodyPartNames(model)
  11.     for _, part in ipairs(model:GetChildren()) do
  12.         if part:IsA("BasePart") and not (string.find(part.Name, "Arm") and gunEquipped) then
  13.             return part
  14.         end
  15.     end
  16. end
  17. RunService.RenderStepped:Connect(function()
  18.     if not Torso or dead or vehicleSeated or (Character:FindFirstChild("Head") and Character.Head.LocalTransparencyModifier == 0) then
  19.         return
  20.     end
  21.  
  22.     gunEquipped = Character:FindFirstChildWhichIsA("Tool") and Character:FindFirstChildWhichIsA("Tool"):FindFirstChild("SPH_Weapon")
  23.     local armsEnabled = Torso["Left Shoulder"].Enabled
  24.  
  25.     for _, obj in ipairs(Character:GetChildren()) do
  26.         if obj:IsA("BasePart") then
  27.             local shouldHide = (string.find(obj.Name, "Arm") and armsEnabled) or
  28.                 string.find(obj.Name, "Leg") or
  29.                 string.find(obj.Name, "Torso") or
  30.                 string.find(obj.Name, "Foot")
  31.             obj.LocalTransparencyModifier = shouldHide and 0 or 1
  32.         elseif obj:IsA("Model") and obj:FindFirstChildWhichIsA("BasePart") then
  33.             local middlePart = obj:FindFirstChild("Middle") or obj:FindFirstChild("Grip") or CheckForBodyPartNames(obj)
  34.             if middlePart and obj.Name ~= "WeaponRig" then
  35.                 if string.find(obj.Name, "Holster_") and not config.firstPersonHolsters then
  36.                     continue
  37.                 end
  38.                 middlePart.LocalTransparencyModifier = 0
  39.             end
  40.         elseif obj:IsA("Model") and obj.Name == "Armor" then
  41.             for _, bodyPart in ipairs(obj:GetChildren()) do
  42.                 if bodyPart.Name ~= "Head" then
  43.                     for _, part in ipairs(bodyPart:GetDescendants()) do
  44.                         if part:IsA("BasePart") or part:IsA("Texture") or part:IsA("Decal") then
  45.                             part.LocalTransparencyModifier = 0
  46.                         end
  47.                     end
  48.                 end
  49.             end
  50.         end
  51.     end
  52. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement