Advertisement
patrickkkkkkkkk

Untitled

Feb 4th, 2024 (edited)
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.44 KB | None | 0 0
  1. -- BETA_Empereanimate_1 (BE1)
  2.  
  3. -- > This script doesn't have a server yet, but it will very soon! < --
  4. -- > This is optimized and won't cause you any FPS drops. If there are any it's most probably caused by another one!
  5.  
  6. -- Subject to change, not everything here is final. Especially because this is a beta!
  7. -- For any bugs, contact me through HAX or Genesis. @zhgf
  8. -- Made by Emper - zhgf#0
  9. -- Don't obfuscate ( The reanimation ) or remove credits.
  10. -- Open sourced, don't steal the code.
  11. -- For any help: Don't ask in DMs, ping me in HAX and I will be glad to answer once I'm free
  12. -- Remember to put the reanimate and the convert script in the same one. REANIMATE GOES FIRST, THE SCRIPT GOES AFTER!
  13. -- Have fun <3
  14.  
  15. --[[
  16. PFAQ:
  17.  
  18. Q: "How do I change the hats?"
  19. A: This question will be answered in RELEASE_Empereanimate_1
  20.  
  21. Q: "How do I align the hats to a sword, object...?"
  22. A: table.insert(Aligns, { AccessoryHandle, BasePart, CFramenew(0, 1, 0) }) -- ( Do not put in a loop and after the reanimation!)
  23.  
  24. Q: "My body doesn't appear!"
  25. A: Make sure you're wearing the hats and that the reanimation isn't erroring, or if you don't have access to sethiddenproperty (In Studio) then wait 1-2 minutes till your body starts appearing. ( Claiming )
  26.  
  27. Q: "Does this work with R15?"
  28. A: Yes, but the Rig will always be R6.
  29.  
  30. Q: "Can I use this in my hub, script...?"
  31. A: As long as credits are present, yes. ( They need to be very clear! ) Example: -- This script uses Empereanimate, made by Emper - zhgf#0
  32.  
  33. Q: "When will fling be added?" - rqz
  34. A: In another BETA, but you can be sure that it will be in RELEASE_Empereanimate_1
  35.  
  36. ]]
  37.  
  38.  
  39.  
  40. if not game:IsLoaded() then
  41. game.Loaded:Wait()
  42. end
  43.  
  44. local Aligns = { }
  45. local Accessories = { }
  46. local Attachments = { }
  47.  
  48. local Instancenew = Instance.new
  49.  
  50. local taskwait = task.wait
  51. local taskspawn = task.spawn
  52. local taskdefer = task.defer
  53.  
  54. local mathcos = math.cos
  55. local mathrandom = math.random
  56.  
  57. local stringmatch = string.match
  58.  
  59. local osclock = os.clock
  60.  
  61. local tableinsert = table.insert
  62. local tableclear = table.clear
  63.  
  64. local CFramenew = CFrame.new
  65. local CFrameAngles = CFrame.Angles
  66. local CFrameidentity = CFrame.identity
  67.  
  68. local Vector3new = Vector3.new
  69. local Vector3zero = Vector3.zero
  70.  
  71. local Sleep = CFrameidentity
  72. local Angular = 0
  73. local Linear = 0
  74.  
  75. local Workspace = game:FindFirstChildOfClass("Workspace")
  76. local CurrentCamera = Workspace.CurrentCamera
  77.  
  78. local Players = game:FindFirstChildOfClass("Players")
  79.  
  80. local LocalPlayer = Players.LocalPlayer
  81. local Mouse = LocalPlayer:GetMouse()
  82.  
  83. local Character = LocalPlayer.Character
  84. local CharacterClone = Instancenew("Model")
  85.  
  86. local function Part(Name, Size)
  87. local Part = Instancenew("Part")
  88. Part.Name = Name
  89. Part.Size = Size
  90. Part.Transparency = 1
  91. Part.Parent = CharacterClone
  92.  
  93. return Part
  94. end
  95.  
  96. local function Motor6D(Name, Part0, Part1, C0, C1)
  97. local Motor6D = Instancenew("Motor6D")
  98. Motor6D.Name = Name
  99. Motor6D.Part0 = Part0
  100. Motor6D.Part1 = Part1
  101. Motor6D.C0 = C0
  102. Motor6D.C1 = C1
  103. Motor6D.Parent = Part0
  104.  
  105. return Motor6D
  106. end
  107.  
  108. local function Attachment(Name, CFrame, Parent)
  109. local Attachment = Instancenew("Attachment")
  110. Attachment.Name = Name
  111. Attachment.CFrame = CFrame
  112. Attachment.Parent = Parent
  113.  
  114. tableinsert(Attachments, Attachment)
  115. return Attachment
  116. end
  117.  
  118. local function FindInstance(Parent, ClassName, Name)
  119. for _, Instance in pairs(Parent:GetChildren()) do
  120. if Instance:IsA(ClassName) and Instance.Name == Name then
  121. return Instance
  122. end
  123. end
  124. end
  125.  
  126. local function WaitForClass(Parent, ClassName)
  127. local Instance = Parent:FindFirstChildOfClass(ClassName)
  128.  
  129. while not Instance and Parent do
  130. Parent.ChildAdded:Wait()
  131. Instance = Parent:FindFirstChildOfClass(ClassName)
  132. end
  133.  
  134. return Instance
  135. end
  136.  
  137. local function WaitForClassOfName(Parent, ...)
  138. local Instance = FindInstance(Parent, ...)
  139.  
  140. while not Instance and Parent do
  141. Parent.ChildAdded:Wait()
  142. Instance = FindInstance(Parent, ...)
  143. end
  144.  
  145. return Instance
  146. end
  147.  
  148. local LimbSize = Vector3new(1, 2, 1)
  149. local TorsoSize = Vector3new(2, 2, 1)
  150.  
  151. local Head = Part("Head", Vector3new(2, 1, 1))
  152. local Torso = Part("Torso", TorsoSize)
  153. local LeftArm = Part("Left Arm", LimbSize)
  154. local RightArm = Part("Right Arm", LimbSize)
  155. local LeftLeg = Part("Left Leg", LimbSize)
  156. local RightLeg = Part("Right Leg", LimbSize)
  157. local HumanoidRootPart = Part("HumanoidRootPart", TorsoSize)
  158.  
  159. local Part = nil
  160.  
  161. if Character then
  162. Part = FindInstance(Character, "BasePart", "HumanoidRootPart") or FindInstance(Character, "BasePart", "Head") or FindInstance(Character, "BasePart", "Torso") or FindInstance(Character, "BasePart", "UpperTorso")
  163. end
  164.  
  165. if Part then
  166. HumanoidRootPart.CFrame = Part.CFrame
  167. else
  168. local SpawnLocations = { }
  169.  
  170. for _, SpawnLocation in pairs(Workspace:GetDescendants()) do
  171. if SpawnLocation:IsA("SpawnLocation") then
  172. tableinsert(SpawnLocations, SpawnLocation)
  173. end
  174. end
  175.  
  176. local Amount = # SpawnLocations
  177.  
  178. if Amount > 0 then
  179. local SpawnLocation = SpawnLocations[mathrandom(1, Amount)]
  180. HumanoidRootPart.CFrame = SpawnLocation.CFrame * CFramenew(0, SpawnLocation.Size.Y / 2 + 3, 0)
  181. else
  182. HumanoidRootPart.CFrame = CFrameidentity
  183. end
  184. end
  185.  
  186. local face = Instancenew("Decal")
  187. face.Name = "face"
  188. face.Parent = Head
  189.  
  190. local AccessoryTable = {
  191. { Mesh = "14085008200", Texture = "14085008225", Instance = Torso },
  192. { Mesh = "13610799467", Texture = "13610799583", Instance = RightArm, CFrame = CFrameAngles(1.57, 0, 0) },
  193. { Mesh = "11159370334", Texture = "11159284657", Instance = LeftArm, CFrame = CFrameAngles(0, 1.57, 1.57) },
  194. { Mesh = "11263221350", Texture = "11263219250", Instance = RightLeg, CFrame = CFrameAngles(0, - 1.57, 1.57) },
  195. { Mesh = "11159370334", Texture = "11159285454", Instance = LeftLeg, CFrame = CFrameAngles(0, 1.57, 1.57) },
  196. }
  197.  
  198. Motor6D("Right Shoulder", Torso, RightArm, CFramenew(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFramenew(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0))
  199. Motor6D("Left Shoulder", Torso, LeftArm, CFramenew(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFramenew(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0))
  200. Motor6D("Right Hip", Torso, RightLeg, CFramenew(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFramenew(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0))
  201. Motor6D("Left Hip", Torso, LeftLeg, CFramenew(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFramenew(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0))
  202. Motor6D("Neck", Torso, Head, CFramenew(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0), CFramenew(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0))
  203. Motor6D("RootJoint", HumanoidRootPart, Torso, CFramenew(0, 0, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0), CFramenew(0, 0, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0))
  204.  
  205. Attachment("HairAttachment", CFramenew(0, 0.600000024, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), Head)
  206. Attachment("HatAttachment", CFramenew(0, 0.600000024, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), Head)
  207. Attachment("FaceFrontAttachment", CFramenew(0, 0, -0.600000024, 1, 0, 0, 0, 1, 0, 0, 0, 1), Head)
  208. Attachment("FaceCenterAttachment", CFramenew(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), Head)
  209. Attachment("NeckAttachment", CFramenew(0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), Torso)
  210. Attachment("BodyFrontAttachment", CFramenew(0, 0, -0.5, 1, 0, 0, 0, 1, 0, 0, 0, 1), Torso)
  211. Attachment("BodyBackAttachment", CFramenew(0, 0, 0.5, 1, 0, 0, 0, 1, 0, 0, 0, 1), Torso)
  212. Attachment("LeftCollarAttachment", CFramenew(-1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), Torso)
  213. Attachment("RightCollarAttachment", CFramenew(1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), Torso)
  214. Attachment("WaistFrontAttachment", CFramenew(0, -1, -0.5, 1, 0, 0, 0, 1, 0, 0, 0, 1), Torso)
  215. Attachment("WaistCenterAttachment", CFramenew(0, -1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), Torso)
  216. Attachment("WaistBackAttachment", CFramenew(0, -1, 0.5, 1, 0, 0, 0, 1, 0, 0, 0, 1), Torso)
  217. Attachment("LeftShoulderAttachment", CFramenew(0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), LeftArm)
  218. Attachment("LeftGripAttachment", CFramenew(0, -1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), LeftArm)
  219. Attachment("RightShoulderAttachment", CFramenew(0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), RightArm)
  220. Attachment("RightGripAttachment", CFramenew(0, -1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), RightArm)
  221. Attachment("LeftFootAttachment", CFramenew(0, -1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), LeftLeg)
  222. Attachment("RightFootAttachment", CFramenew(0, -1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), RightLeg)
  223. Attachment("RootAttachment", CFramenew(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), HumanoidRootPart)
  224.  
  225. local Humanoid = Instancenew("Humanoid", CharacterClone)
  226. Instancenew("Animator", Humanoid)
  227.  
  228. CharacterClone.PrimaryPart = Head
  229. CharacterClone.Parent = Workspace
  230.  
  231. local function DescendantAdded(Instance)
  232. if Instance:IsA("Accessory") then
  233. taskspawn(function()
  234. local Handle = WaitForClassOfName(Instance, "BasePart", "Handle")
  235.  
  236. if Handle then
  237. local Attachment = WaitForClass(Handle, "Attachment")
  238.  
  239. if Attachment then
  240. local Clone = Instance:Clone()
  241. local CloneHandle = FindInstance(Clone, "BasePart", "Handle")
  242.  
  243. CloneHandle.Transparency = 1
  244. CloneHandle:BreakJoints()
  245.  
  246. local AccessoryWeld = Instancenew("Weld")
  247. AccessoryWeld.Name = "AccessoryWeld"
  248. AccessoryWeld.Part0 = CloneHandle
  249. AccessoryWeld.C0 = Attachment.CFrame
  250.  
  251. local Name = Attachment.Name
  252.  
  253. for _, TableAttachment in pairs(Attachments) do
  254. if TableAttachment.Name == Name then
  255. AccessoryWeld.Part1 = TableAttachment.Parent
  256. AccessoryWeld.C1 = TableAttachment.CFrame
  257. end
  258. end
  259.  
  260. AccessoryWeld.Parent = CloneHandle
  261. Clone.Parent = CharacterClone
  262.  
  263. tableinsert(Accessories, Clone)
  264.  
  265. local Part1 = CloneHandle
  266. local CFrame = CFrameidentity
  267.  
  268. local IsAMeshPart = CloneHandle:IsA("MeshPart")
  269. local Mesh = IsAMeshPart and CloneHandle or WaitForClass(CloneHandle, "SpecialMesh")
  270. local Id = IsAMeshPart and "TextureID" or "TextureId"
  271.  
  272. for _, Table in pairs(AccessoryTable) do
  273. if stringmatch(Mesh.MeshId, Table.Mesh) and stringmatch(Mesh[Id], Table.Texture) then
  274. Part1 = Table.Instance
  275. CFrame = Table.CFrame or CFrame
  276. end
  277. end
  278.  
  279. tableinsert(Aligns, { Handle, Part1, CFrame })
  280. end
  281. end
  282. end)
  283. elseif Instance:IsA("JointInstance") then
  284. taskdefer(Instance.Destroy, Instance)
  285. end
  286. end
  287.  
  288. local function CharacterAdded(Character)
  289. if Character ~= CharacterClone then
  290. taskwait()
  291. tableclear(Aligns)
  292.  
  293. for _, Accessory in pairs(Accessories) do
  294. Accessory:Destroy()
  295. end
  296.  
  297. local CurrentCameraCFrame = CurrentCamera.CFrame
  298.  
  299. LocalPlayer.Character = nil
  300. LocalPlayer.Character = CharacterClone
  301.  
  302. CurrentCamera.CameraSubject = Humanoid
  303.  
  304. taskspawn(function()
  305. CurrentCamera:GetPropertyChangedSignal("CFrame"):Wait()
  306. CurrentCamera.CFrame = CurrentCameraCFrame
  307. end)
  308.  
  309. WaitForClassOfName(Character, "BasePart", "HumanoidRootPart").CFrame = HumanoidRootPart.CFrame * CFramenew(mathrandom(- 32, 32), 0, mathrandom(- 32, 32))
  310. taskwait()
  311. Character:BreakJoints()
  312.  
  313. for _, Instance in pairs(Character:GetDescendants()) do
  314. DescendantAdded(Instance)
  315. end
  316.  
  317. Character.DescendantAdded:Connect(DescendantAdded)
  318. end
  319. end
  320.  
  321. local function Align(Part0, Part1, CFrame)
  322. if Part0.ReceiveAge == 0 and not Part0.Anchored and # Part0:GetJoints() == 0 then
  323. Part0.AssemblyAngularVelocity = Part1.AssemblyAngularVelocity + Vector3new(Angular, Angular, Angular)
  324.  
  325. local Part1CFrame = Part1.CFrame
  326. local LinearVelocity = Part1.AssemblyLinearVelocity * Linear
  327. local Magnitude = LinearVelocity.Magnitude < Linear
  328.  
  329. if Magnitude then
  330. local LookVector = Part1CFrame.LookVector * Linear
  331. Part0.AssemblyLinearVelocity = Vector3new(LookVector.X, - Linear, LookVector.Z)
  332. else
  333. Part0.AssemblyLinearVelocity = Vector3new(LinearVelocity.X, Linear, LinearVelocity.Z)
  334. end
  335.  
  336. Part0.CFrame = Part1CFrame * Sleep * CFrame
  337. end
  338. end
  339.  
  340. if Character then
  341. CharacterAdded(Character)
  342. end
  343.  
  344. local Added = LocalPlayer.CharacterAdded:Connect(CharacterAdded)
  345.  
  346. local Connection = game:FindFirstChildOfClass("RunService").PostSimulation:Connect(function()
  347. local osclock = osclock() * 100
  348. local Axis = 0.001 * mathcos(osclock)
  349.  
  350. Sleep = CFramenew(Axis, 0, 0)
  351. Angular = mathcos(osclock)
  352. Linear = 26 + Angular
  353.  
  354. for _, Table in pairs(Aligns) do
  355. Align(Table[1], Table[2], Table[3])
  356. end
  357.  
  358. if sethiddenproperty then
  359. sethiddenproperty(LocalPlayer, "SimulationRadius", 10000000)
  360. end
  361. end)
  362.  
  363. CharacterClone:GetPropertyChangedSignal("Parent"):Connect(function()
  364. if not CharacterClone.Parent then
  365. Added:Disconnect()
  366. Connection:Disconnect()
  367. CharacterClone:Destroy()
  368. end
  369. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement