Advertisement
Lazzzycat1

FPScam

Jan 2nd, 2025
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.49 KB | Gaming | 0 0
  1. local config = require(game:GetService("ReplicatedStorage").SPH_Assets.GameConfig)
  2. local dead = false
  3. local vehicleSeated
  4.  
  5. if config.firstPersonBody then
  6.     local Character = script.Parent.Parent
  7.     local RunService = game:GetService("RunService")
  8.     local gunEquipped
  9.  
  10.     local humanoid = Character:WaitForChild("Humanoid")
  11.     local torso
  12.     if humanoid.RigType == Enum.HumanoidRigType.R6 then
  13.         torso = Character:WaitForChild("Torso")
  14.     else
  15.         torso = Character:WaitForChild("UpperTorso")
  16.     end
  17.  
  18.     humanoid.Died:Connect(function()
  19.         dead = true
  20.     end)
  21.  
  22.     local function CheckForBodyPartNames(model)
  23.         for _, part in ipairs(model:GetChildren()) do
  24.             local checkPart = Character:FindFirstChild(part.Name)
  25.             if checkPart and checkPart:IsA("BasePart") then
  26.                 if not (string.find(checkPart.Name,"Arm") and gunEquipped) then
  27.                     return part
  28.                 end
  29.             end
  30.         end
  31.     end
  32.  
  33.     RunService.RenderStepped:Connect(function(dt)
  34.         if not Character:FindFirstChild("Torso") and not Character:FindFirstChild("UpperTorso") or dead or vehicleSeated then
  35.             return
  36.         elseif Character:FindFirstChild("Head") and Character.Head.LocalTransparencyModifier == 0 then
  37.             return
  38.         end
  39.  
  40.         gunEquipped = Character:FindFirstChildWhichIsA("Tool")
  41.         if gunEquipped and not gunEquipped:FindFirstChild("SPH_Weapon") then gunEquipped = nil end
  42.  
  43.         local armsEnabled = torso["Left Shoulder"].Enabled
  44.  
  45.         for _, obj in ipairs(Character:GetChildren()) do
  46.             if obj:IsA("BasePart") then
  47.                 if (string.find(obj.Name,"Arm") and armsEnabled)
  48.                     or string.find(obj.Name,"Leg")
  49.                     or string.find(obj.Name,"Torso")
  50.                     or string.find(obj.Name,"Foot") then
  51.                     obj.LocalTransparencyModifier = 0
  52.                 end
  53.  
  54.             elseif obj:IsA("Model") and obj:FindFirstChildWhichIsA("BasePart") then
  55.                 -- Conventional morph
  56.                 local middlePart = obj:FindFirstChild("Middle") or obj:FindFirstChild("Grip") or CheckForBodyPartNames(obj)
  57.                 if (middlePart and obj.Name ~= "WeaponRig") then
  58.                     if string.find(obj.Name,"Holster_") and not config.firstPersonHolsters then continue end
  59.                     local welds = middlePart:GetJoints()
  60.                     local badMorph = false
  61.                     for _, cWeld in ipairs(welds) do
  62.                         if cWeld.Part0 == Character.Head or cWeld.Part1 == Character.Head then
  63.                             badMorph = true
  64.                             break
  65.                         elseif (string.find(cWeld.Part0.Name,"Arm") or string.find(cWeld.Part1.Name,"Arm")) and gunEquipped then
  66.                             badMorph = true
  67.                             break
  68.                         end
  69.                     end
  70.  
  71.                     if badMorph then continue end
  72.                     for _, part in ipairs(obj:GetDescendants()) do
  73.                         if part:IsA("BasePart") or part:IsA("Texture") or part:IsA("Decal") then
  74.                             part.LocalTransparencyModifier = 0
  75.                         end
  76.                     end
  77.  
  78.                     -- Non conventional morphs that only include one part
  79.                 elseif #obj:GetChildren() == 1 then
  80.                     local part = obj:FindFirstChildWhichIsA("BasePart")
  81.                     local welds = part:GetJoints()
  82.                     local headMorph = false
  83.                     for _, cWeld in ipairs(welds) do
  84.                         if cWeld.Part0 == Character.Head or cWeld.Part1 == Character.Head then
  85.                             headMorph = true
  86.                             break
  87.                         end
  88.                     end
  89.  
  90.                     if not headMorph then
  91.                         part.LocalTransparencyModifier = 0
  92.                         for _, child in ipairs(part:GetChildren()) do
  93.                             if child:IsA("Texture") or child:IsA("Decal") then
  94.                                 child.LocalTransparencyModifier = 0
  95.                             end
  96.                         end
  97.                     end
  98.                 end
  99.             end
  100.         end
  101.     end)
  102.  
  103.     humanoid.Seated:Connect(function(seated, seatPart)
  104.         if seated and seatPart:IsA("VehicleSeat") then
  105.             vehicleSeated = true
  106.         else
  107.             vehicleSeated = false
  108.         end
  109.     end)
  110. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement