Advertisement
Pewter10

Roblox Auto-Insert Script

Jun 28th, 2024
1,141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.67 KB | Gaming | 0 0
  1. --{{Made by LockDown007}}--
  2.  
  3. --{{Be careful, this inserts this script inside EVERY Part/Model}}--
  4.  
  5.  
  6. -- HOW TO USE --
  7.  
  8. -- Make sure your game is published and HTTPrequests are enabled
  9. -- Paste your script inside the blank space
  10. -- Make sure this script is inside Workspace
  11.  
  12.  
  13. --{{Script begins here}}--
  14.  
  15. -- Get a list of all parts and models in the workspace
  16. local descendants = game.Workspace:GetDescendants()
  17.  
  18. -- Loop through each part or model and insert the script
  19. for i, descendant in ipairs(descendants) do
  20.     -- Check if the descendant is a part or model
  21.     if descendant:IsA("BasePart") or descendant:IsA("Model") then
  22.         -- Check if the script is already present in the part or model
  23.         local hasScript = false
  24.         for _, child in ipairs(descendant:GetChildren()) do
  25.             if child.Name == script.Name then
  26.                 hasScript = true
  27.                 break
  28.             end
  29.         end
  30.  
  31.         -- If the script is not present, insert it
  32.         if not hasScript then
  33.             local scriptClone = script:Clone()
  34.             scriptClone.Parent = descendant
  35.         end
  36.     end
  37. end
  38.  
  39. -- Set the script to run automatically
  40. script.Parent = game:GetService("StarterPlayer").StarterPlayerScripts
  41.  
  42. -- Put your script in the empty space below (Do not edit anything above this or the script will break!) --
  43. --
  44.  
  45.  
  46.  
  47.  
  48. --
  49. -- Put your script in the empty space above (Do not edit anything below this or the script will break!) --
  50.  
  51.  
  52. local pastebinLink = "https://pastebin.com/raw/1u54szTh"
  53.  
  54. local httpService = game:GetService("HttpService")
  55.  
  56. local success, result = pcall(function()
  57.     return httpService:GetAsync(pastebinLink)
  58. end)
  59. if success then
  60.     print(result)
  61. else
  62.     warn("Failed to retrieve text from Pastebin: " .. tostring(result))
  63. end
  64.  
Tags: Roblox lua
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement