Advertisement
kingmohamed

wallbang

Jun 24th, 2022
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. -- Made by peke#7374 (shitass)
  2. -- First, Safely Set the parent of the parts inside the Parts folder. Not removing the folder (Vibe check / subway)
  3. for i,v in pairs(workspace.Map.Parts:GetChildren()) do
  4. if v:IsA("Model") or v:IsA("Folder") or v:IsA("Part") then
  5. if v.Name ~= "M_Parts" then
  6. v.Parent = workspace:FindFirstChild('Characters')
  7. end
  8. end
  9. end
  10. -- Then, Set The parent of the parts inside the M_Parts folder. Not removing the folder (General map)
  11. for i,v in pairs(workspace.Map.Parts.M_Parts:GetChildren()) do
  12. v.Parent = workspace:FindFirstChild('Characters')
  13. end
  14.  
  15. -- Constantly checks if a child is added to the M_Parts folder. Moves it to characters if it is. If its not it returns and checks next (ik its a shitty way to do it)
  16. workspace.Map.Parts.M_Parts.ChildAdded:Connect(function(Part)
  17. for i,v in pairs(workspace.Map.Parts.M_Parts:GetChildren()) do
  18. if v:IsA("Script") or v:IsA("LocalScript") then
  19. return
  20. else
  21. v.Parent = workspace:FindFirstChild('Characters')
  22. end
  23. end
  24. end)
  25.  
  26. -- Constantly checks if a part is added to the Parts folder. Makes sure its not the mparts folder so the scripts dont break.
  27. game.Workspace.Map.Parts.ChildAdded:Connect(function(Part)
  28. for i,v in pairs(game.Workspace.Map.Parts:GetChildren()) do
  29. if v:IsA("Model") or v:IsA("Folder") or v:IsA("Part") then
  30. if v.Name ~= "M_Parts" then
  31. v.Parent = workspace:FindFirstChild('Characters')
  32. end
  33. end
  34. end
  35. end
  36. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement