Advertisement
TaylorsRus

Untitled

Dec 5th, 2021
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. function OmnitrixFunctions.Transform(char, humrp)
  2.  
  3. local plr = game.Players:GetPlayerFromCharacter(char) or error("No player exists for this Character.")
  4.  
  5. if char:GetAttribute("OmnitrixStatus") == "Transformed" or char:GetAttribute("OmnitrixStatus") == "Recharging" then return end
  6.  
  7. if char then
  8.  
  9. local TransformAnim = char:WaitForChild("Humanoid").Animator:LoadAnimation(AnimFolder:WaitForChild("Transform"))
  10. TransformAnim:Play()
  11.  
  12. local AlienFolder = SS:WaitForChild("Assets").Models.AlienModels
  13. local Alien = AlienFolder:WaitForChild(OmnitrixData.Aliens[char:GetAttribute("SelectedAlien")]):Clone()
  14.  
  15. if Alien then
  16. Alien.HumanoidRootPart.Anchored = false
  17. Alien:WaitForChild("HumanoidRootPart").CFrame = humrp.CFrame * PlaceNewChar
  18. else
  19. error("No alien available for this integer value.")
  20. end
  21.  
  22. if char:GetAttribute("OmnitrixStatus") == "Down" then
  23. char:SetAttribute("SelectedAlien", (math.random(FirstAlien, #LastAlien)))
  24. end
  25.  
  26. task.wait(.5)
  27.  
  28. char.Archivable = true
  29.  
  30. local CharClone = char:Clone()
  31. CharClone.Parent = plr
  32.  
  33. if char:GetAttribute("OmnitrixStatus") == "Down" then
  34. char:SetAttribute("SelectedAlien", (math.random(1, #AlienFolder:GetChildren())))
  35. end
  36.  
  37. for _,Guts in pairs(char:GetChildren()) do
  38.  
  39. if Guts:IsA("Script") or Guts:IsA("LocalScript") or Guts:IsA("Folder") or Guts:IsA("Humanoid") then
  40.  
  41. Guts:Clone().Parent = Alien
  42.  
  43. elseif Guts:IsA("BasePart") and Guts.Name == "HumanoidRootPart" then
  44.  
  45. for _,RootAssets in pairs(Guts:GetChildren()) do
  46.  
  47. RootAssets:Clone().Parent = Alien.HumanoidRootPart
  48. end
  49. end
  50. end
  51.  
  52. plr.Character = Alien
  53. Alien.Parent = workspace:WaitForChild("LivingThings")
  54.  
  55. char:Destroy()
  56. char = plr.Character
  57. humrp = char:WaitForChild("HumanoidRootPart")
  58.  
  59. humrp:WaitForChild("OmnitrixTransform"):Play()
  60. humrp:WaitForChild("OmnitrixTransformEffect"):Emit(35)
  61. ChangeStats(char, Alien)
  62.  
  63. print("You are now ".. Alien.Name..".")
  64.  
  65. for i = 1, 600 do
  66. task.wait(1)
  67.  
  68. if DeTransforming then break end
  69. if i == 600 then OmnitrixFunctions:UnTransform(char) end
  70. end
  71. else
  72. print("No Character exists.")
  73. end
  74. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement