TheUnknownDiscord

dualies

Nov 1st, 2022 (edited)
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.70 KB | None | 0 0
  1. local pppp = Instance.new("Part",script)
  2. pppp.CanQuery = false
  3. pppp.Anchored = true
  4. pppp.CanCollide = false
  5. pppp.Size = Vector3.new()
  6. pppp.Transparency = 1
  7. local s = Instance.new("Sound")
  8. s.PlayOnRemove = true
  9. s.Volume = 1.6
  10. s.SoundId = "rbxassetid://6828928602"
  11. local model = game:GetService("Players"):CreateHumanoidModelFromDescription(game:GetService("Players"):GetHumanoidDescriptionFromUserId(owner.UserId),1)
  12. local rt = Instance.new("Part",owner.Character)
  13. rt.CanCollide = false
  14. rt.Transparency = 1
  15. rt.Size = model:WaitForChild("UpperTorso").Size
  16. rt.Name = "UpperTorso"
  17. rt.Massless = true
  18. local lt = Instance.new("Part",owner.Character)
  19. lt.CanCollide = false
  20. lt.Transparency = 1
  21. lt.Size = model:WaitForChild("LowerTorso").Size
  22. lt.Name = "LowerTorso"
  23. lt.Massless = true
  24. local w = Instance.new("Weld",rt)
  25. w.Part0 = lt
  26. w.Part1 = rt
  27. w.Name = "Waist"
  28. w.C1 = model:WaitForChild("UpperTorso"):WaitForChild("Waist").C1
  29. w.C0 = model:WaitForChild("UpperTorso"):WaitForChild("Waist").C0
  30. local w = Instance.new("Weld",lt)
  31. w.Part0 = owner.Character.HumanoidRootPart
  32. w.Part1 = lt
  33. w.Name = "Root"
  34. w.C1 = model:WaitForChild("LowerTorso"):WaitForChild("Root").C1
  35. w.C0 = model:WaitForChild("LowerTorso"):WaitForChild("Root").C0
  36. local rul = Instance.new("Part",owner.Character)
  37. rul.CanCollide = false
  38. rul.Transparency = 1
  39. rul.Size = model:WaitForChild("RightUpperLeg").Size
  40. rul.Name = "RightUpperLeg"
  41. rul.Massless = true
  42. local w = Instance.new("Weld",rul)
  43. w.Part0 = lt
  44. w.Part1 = rul
  45. w.Name = "RightHip"
  46. w.C1 = model:WaitForChild("RightUpperLeg"):WaitForChild("RightHip").C1
  47. w.C0 = model:WaitForChild("RightUpperLeg"):WaitForChild("RightHip").C0
  48. local lul = Instance.new("Part",owner.Character)
  49. lul.CanCollide = false
  50. lul.Transparency = 1
  51. lul.Size = model:WaitForChild("LeftUpperLeg").Size
  52. lul.Name = "LeftUpperLeg"
  53. lul.Massless = true
  54. local w = Instance.new("Weld",lul)
  55. w.Part0 = lt
  56. w.Part1 = lul
  57. w.Name = "LeftHip"
  58. w.C1 = model:WaitForChild("LeftUpperLeg"):WaitForChild("LeftHip").C1
  59. w.C0 = model:WaitForChild("LeftUpperLeg"):WaitForChild("LeftHip").C0
  60. local rll = Instance.new("Part",owner.Character)
  61. rll.CanCollide = false
  62. rll.Transparency = 1
  63. rll.Size = model:WaitForChild("RightLowerLeg").Size
  64. rll.Name = "RightLowerLeg"
  65. rll.Massless = true
  66. local w = Instance.new("Weld",rll)
  67. w.Part0 = rul
  68. w.Part1 = rll
  69. w.Name = "RightKnee"
  70. w.C1 = model:WaitForChild("RightLowerLeg"):WaitForChild("RightKnee").C1
  71. w.C0 = model:WaitForChild("RightLowerLeg"):WaitForChild("RightKnee").C0
  72. local lll = Instance.new("Part",owner.Character)
  73. lll.CanCollide = false
  74. lll.Transparency = 1
  75. lll.Size = model:WaitForChild("LeftLowerLeg").Size
  76. lll.Name = "LeftLowerLeg"
  77. lll.Massless = true
  78. local w = Instance.new("Weld",lll)
  79. w.Part0 = lul
  80. w.Part1 = lll
  81. w.Name = "LeftKnee"
  82. w.C1 = model:WaitForChild("LeftLowerLeg"):WaitForChild("LeftKnee").C1
  83. w.C0 = model:WaitForChild("LeftLowerLeg"):WaitForChild("LeftKnee").C0
  84. local w = Instance.new("Weld",lll)
  85. w.Part0 = owner.Character["Left Leg"]
  86. w.Part1 = lll
  87. local w2 = Instance.new("Weld",rll)
  88. w2.Part0 = owner.Character["Right Leg"]
  89. w2.Part1 = rll
  90. w.Enabled = false
  91. w2.Enabled = false
  92. w.C0 = CFrame.new(0,-0.25,0)
  93. w2.C0 = CFrame.new(0,-0.25,0)
  94. local IK_HANDLER = {}
  95. IK_HANDLER.__index = IK_HANDLER
  96.  
  97. local Pi = math.pi -- We are using radian-based angles (rather than degree), so we use Pi! Pi radians = 180 degrees
  98. local HalfPi = Pi/2 -- Pi/2 radians = 90 degrees.
  99. local Tau = 2*Pi -- 2pi radians = 360 degrees. And yes, Tau is a word! Represented by symbol 't'
  100.  
  101. local ForwardVector = Vector3.new(0,0,-1) -- Get a forward-directional Vector3
  102. local YAxisExclusion = Vector3.new(1,0,1) -- This will be used later; Vector3*YAxisExclusion will remove the middle value, or the y-value.
  103.  
  104. local RightHipCFrame = CFrame.new(0.55, -0.4, 0) -- The self.RightRotationAngle-hip reference CFrame, relative to the RightUpperLeg position
  105. local LeftHipCFrame = CFrame.new(-0.55, -0.4, 0) -- The self.LeftRotationAngle-hip reference CFrame, relative to the LeftUpperLeg position
  106. local RightHipCFrame2 = CFrame.new(0.55,-2.7,0)
  107. local LeftHipCFrame2 = CFrame.new(-0.55,-2.7,0)
  108.  
  109. local RightIdleCFrame = CFrame.new(0.28,-1.9,0.03) -- Idle CFrame of Motor6D joint
  110. local LeftIdleCFrame = CFrame.new(-0.28,-1.9,-0.03) -- Idle CFrame of Motor6D joint
  111.  
  112.  
  113. --**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--
  114. --**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--
  115. --**--**--**--**--**--||
  116. --**--**--**--**--**--|| PRIVATE FUNCTIONS
  117. --**--**--**--**--**--||
  118. --**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--
  119. --**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--
  120.  
  121. local function SolveLegIK(o,t,l0,l1) -- Does the major math calculations for IK
  122. -- Make the position local relative to the origin
  123. local l = o:pointToObjectSpace(t) -- World space to local space
  124. local lu = l.Unit -- Get normalized unit for future math
  125.  
  126. local m = l.Magnitude -- Get the length from the position to the target
  127.  
  128. -- Make a CFrame pointing from the shoulder position directing to the second position
  129. local x = ForwardVector:Cross(-lu) -- Cross the forward vector with the negative of the normalized unit
  130. local g = math.acos(-lu.Z) -- Get the arc-cosine of the negative normalized unit
  131. local p = o*CFrame.fromAxisAngle(x,g):Inverse() -- Get the IK plane
  132.  
  133. -- In a self.RightRotationAngle-triangle, we have the hypotenuse and the two shorter legs.
  134. -- In a self.RightRotationAngle triangle, the hypotenuse is side "c," and the legs are a and b.
  135. -- This information will be helpful later on.
  136.  
  137. if m < math.max(l1,l0)-math.min(l1,l0) then
  138. -- If c is between the lengths of a and b then return an offsetted plane so that one of the lengths reaches the goal,
  139. -- but the other length is folded so it looks natural
  140. -- This cacluation is done when a position comes before the end of the leg, and may look a bit... odd
  141.  
  142. return p*CFrame.new(0,0,math.max(l1,l0)-math.min(l1,l0)-m),-HalfPi,Pi
  143. elseif m > l0+l1 then
  144. -- If c > a + b then return flat angles and an offsetted plane which reaches its target
  145. -- Basically, this makes the leg flat if there is nothing to place it on
  146.  
  147. return p,HalfPi,0
  148. else
  149. -- Otherwise, use the law of cosines
  150. -- This is going to be all cases where the leg actually bends
  151.  
  152. local a1 = -math.acos((-(l1*l1)+(l0*l0)+(m*m))/(2*l0*m))
  153. local a2 = math.acos(((l1*l1)-(l0*l0)+(m*m))/(2*l1*m))
  154. return p,HalfPi-a1,-(a2-a1)
  155. end
  156. end
  157.  
  158. local function lerpNumber(a,b,t)return (a+(b-a)*t)end -- Get a number between a and b, given the alpha (t, which can be a number anywhere between 0-1).
  159.  
  160. --**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--
  161. --**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--
  162. --**--**--**--**--**--||
  163. --**--**--**--**--**--|| CLASS CONSTRUCTOR, VARIABLES, AND METHODS
  164. --**--**--**--**--**--||
  165. --**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--
  166. --**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--
  167. local RaycastParameters = RaycastParams.new()
  168. RaycastParameters.IgnoreWater = true
  169. RaycastParameters.FilterType = Enum.RaycastFilterType.Blacklist
  170.  
  171. local ParamBlacklist = {}
  172.  
  173. IK_HANDLER.ActiveInstances = {}
  174.  
  175. function IK_HANDLER.New(Player, Stride, CycleSpeed, MaxRenderDistance, RaycastOffset)
  176. local Character = Player and Player.Character
  177.  
  178. if not Player then
  179. error("Attempted to pass player, got nil")
  180. elseif not Character then
  181. error("Attempted to get Character from " .. Player .. ", got nil")
  182. end
  183.  
  184. local Stride = Stride or 2.6
  185. local CycleSpeed = CycleSpeed or 10
  186. local MaxRenderDistance = MaxRenderDistance or 150
  187. local RaycastOffset = RaycastOffset or 0.3
  188. local self = {}
  189.  
  190. self.Character = Character
  191. self.Humanoid = Character:WaitForChild("Humanoid")
  192. self.HumanoidRootPart = owner.Character.HumanoidRootPart
  193. self.TargetBaseBart = Character:WaitForChild("LowerTorso")
  194. self.WaistJoint = Character:WaitForChild("UpperTorso"):WaitForChild("Waist")
  195. self.RootJoint = self.TargetBaseBart:WaitForChild("Root")
  196. self.WaistCFrame1 = self.WaistJoint.C1
  197. self.RightHip = Character:WaitForChild("RightUpperLeg"):WaitForChild("RightHip")
  198. self.RightKnee = Character:WaitForChild("RightLowerLeg"):WaitForChild("RightKnee")
  199. self.LeftHip = Character:WaitForChild("LeftUpperLeg"):WaitForChild("LeftHip")
  200. self.LeftKnee = Character:WaitForChild("LeftLowerLeg"):WaitForChild("LeftKnee")
  201. self.RightHipCFrame0 = self.RightHip.C0
  202. self.RightKneeCFrame0 = self.RightKnee.C0
  203. self.LeftHipCFrame0 = self.LeftHip.C0
  204. self.LeftKneeCFrame0 = self.LeftKnee.C0
  205. self.LeftRotationAngle = 0
  206. self.RightRotationAngle = Pi
  207. self.Direction = YAxisExclusion -- This will be changed
  208. self.CycleSpeed = CycleSpeed -- How fast the leg-movement cycle is. Change this to suit your needs!
  209. self.StrideCFrame = CFrame.new(0,0,-Stride/2) -- Turn the Stride number into a CFrame we can use for animation
  210. self.PreviousTick = tick()
  211. self.Enabled = true
  212. self.MaxRenderDistance = MaxRenderDistance
  213. self.RaycastOffset = RaycastOffset
  214.  
  215. IK_HANDLER.ActiveInstances[self] = true
  216.  
  217. IK_HANDLER.UpdateRaycastBlacklist()
  218.  
  219. return setmetatable(self, IK_HANDLER) -- We have made an I N S T A N C E (*laughs in programming*)
  220. end
  221.  
  222. function IK_HANDLER.UpdateRaycastBlacklist(Blacklist)
  223. if Blacklist then
  224. ParamBlacklist = Blacklist
  225. end
  226.  
  227. local Mod = {}
  228. for self,_ in pairs(IK_HANDLER.ActiveInstances) do
  229. if self.Character then
  230. table.insert(Mod, self.Character)
  231. end
  232. end
  233.  
  234. RaycastParameters.FilterDescendantsInstances = {unpack(Mod),unpack(ParamBlacklist)}
  235. end
  236.  
  237. --**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--
  238. --**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--
  239. --**--**--**--**--**--||
  240. --**--**--**--**--**--|| INSTANCE METHODS
  241. --**--**--**--**--**--||
  242. --**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--
  243. --**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--**--
  244.  
  245. function IK_HANDLER:IsActive()
  246. if not IK_HANDLER.ActiveInstances[self] then
  247. return false
  248. end
  249.  
  250. if not self.Character or not self.Character.Parent then
  251. IK_HANDLER.ActiveInstances[self] = nil
  252. IK_HANDLER.UpdateRaycastBlacklist()
  253. return false
  254. end
  255.  
  256. return true
  257. end
  258.  
  259. function IK_HANDLER:Destroy()
  260. if IK_HANDLER.ActiveInstances[self] then
  261. IK_HANDLER.ActiveInstances[self] = nil
  262. end
  263.  
  264. for Index, _ in pairs(self) do
  265. self[Index] = nil
  266. end
  267.  
  268. self = nil
  269.  
  270. IK_HANDLER.UpdateRaycastBlacklist()
  271. end
  272.  
  273. function IK_HANDLER:Enable()
  274. self.Enabled = true
  275. end
  276.  
  277. function IK_HANDLER:Disable()
  278. self.Enabled = false
  279. end
  280.  
  281. function IK_HANDLER:Update()
  282. pcall(function()
  283. if not self.Enabled then
  284. return
  285. end
  286.  
  287. if not self.Character or not self.Character.Parent then
  288. IK_HANDLER.ActiveInstances[self] = nil
  289. IK_HANDLER.UpdateRaycastBlacklist()
  290. return
  291. end
  292.  
  293. local CurrentTick = tick()
  294. local Delta = math.clamp(CurrentTick - self.PreviousTick,0.00001,0.5)
  295. local Delta10 = math.min(Delta*10,1) -- Modify Delta for our needs
  296.  
  297. local lowercf = self.TargetBaseBart.CFrame -- Our position
  298. local rootcf = self.HumanoidRootPart.CFrame -- Another position
  299. local rootvel0 = self.HumanoidRootPart.Velocity -- Our movement velocity
  300. local rootvel,rootvelm
  301. local climbing = self.Humanoid:GetState() == Enum.HumanoidStateType.Climbing -- Are we climbing?
  302.  
  303. local RootPosition = rootcf.Position
  304.  
  305.  
  306. --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
  307. --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
  308.  
  309. self.PreviousTick = CurrentTick
  310.  
  311. if climbing then -- Don't animate if we are climbing, it looks weird
  312. rootvel = rootvel0
  313. rootvelm = rootvel.Magnitude
  314. self.Direction = rootcf.lookVector
  315. owner.Character.Humanoid.HipHeight = -1
  316. else
  317. rootvel =rootvel0*YAxisExclusion
  318. rootvelm =rootvel.Magnitude
  319. owner.Character.Humanoid.HipHeight = 0
  320. if rootvelm > 0.1 then
  321. self.Direction = self.Direction:Lerp(rootvel.Unit, Delta10)
  322. end
  323. end
  324.  
  325. --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
  326. --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
  327.  
  328. local up =rootvelm/18
  329. local cycle =up * Delta * self.CycleSpeed
  330.  
  331. self.RightRotationAngle = (self.RightRotationAngle+cycle)%Tau
  332. self.LeftRotationAngle = (self.LeftRotationAngle+cycle)%Tau
  333.  
  334. -- By using modulus and Tau (Tau is a full circle roation), we keep rotations within our imaginary circle. Without this we get really weird joint movement.
  335.  
  336. --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
  337. --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
  338.  
  339. if rootvelm > 0.1 then --// When moving
  340. local relv0 = lowercf:vectorToObjectSpace(rootvel)-- Object space is nice yes?
  341. local relv1 = relv0*0.2
  342. local relvx = relv0.X/rootvel.Magnitude
  343.  
  344. self.WaistJoint.C1 = self.WaistJoint.C1:Lerp(self.WaistCFrame1*CFrame.Angles(math.rad(relv1.Z),0.1*math.cos(self.RightRotationAngle)-2*math.rad(relv1.X),math.rad(-relv1.X)):Inverse(),Delta10) -- Upper Torso Anim
  345.  
  346. local hpmod = HalfPi/20
  347. local kneeRot = 2
  348. local hipAlpha = Delta10*1.5
  349. local kneeAlpha = Delta10*1.5
  350.  
  351. do -- Right Leg
  352. local hip = (rootcf*RightHipCFrame).Position
  353. local ground = (rootcf*RightHipCFrame2).Position
  354. local desiredPos = (CFrame.new(ground, ground+self.Direction)*CFrame.Angles(-self.RightRotationAngle, 0, 0)*self.StrideCFrame*CFrame.new(0.1,0,0)).Position
  355. local offset = (desiredPos-hip)
  356. local raycastResult = workspace:Raycast(hip,offset.Unit*(offset.magnitude+0.6),RaycastParameters)
  357. local footPos = raycastResult and raycastResult.Position or (hip + offset.Unit*(offset.magnitude+self.RaycastOffset))
  358.  
  359. local plane,th1,th2 = SolveLegIK(lowercf*self.RightHipCFrame0,footPos, 0.55,1.15) -- 0.55,1.15
  360. self.RightHip.C0 = self.RightHip.C0:Lerp(lowercf:toObjectSpace(plane)*CFrame.Angles(th1,-hpmod,0),hipAlpha)
  361. self.RightKnee.C0 = self.RightKnee.C0:Lerp(self.RightKneeCFrame0*CFrame.Angles(th2*kneeRot,0,0),kneeAlpha)
  362. end
  363.  
  364. do-- Left Leg
  365. local hip = (rootcf*LeftHipCFrame).Position
  366. local ground =(rootcf*LeftHipCFrame2).Position
  367. local desiredPos = (CFrame.new(ground, ground+self.Direction)*CFrame.Angles(-self.LeftRotationAngle, 0, 0)*self.StrideCFrame*CFrame.new(-0.1,0,0)).Position
  368. local offset = (desiredPos-hip)
  369. local raycastResult = workspace:Raycast(hip,offset.Unit*(offset.magnitude+0.6),RaycastParameters)
  370. local footPos = raycastResult and raycastResult.Position or (hip + offset.Unit*(offset.magnitude+self.RaycastOffset))
  371.  
  372. local plane,th1,th2 = SolveLegIK(lowercf*self.LeftHipCFrame0,footPos, 0.55,1.15)
  373. self.LeftHip.C0 = self.LeftHip.C0:Lerp(lowercf:toObjectSpace(plane)*CFrame.Angles(th1,hpmod,0),hipAlpha)
  374. self.LeftKnee.C0 = self.LeftKnee.C0:Lerp(self.LeftKneeCFrame0*CFrame.Angles(th2*kneeRot,0,0),kneeAlpha)
  375. end
  376. else --// When not moving
  377. -- Upper Torso
  378. self.WaistJoint.C1 =self.WaistJoint.C1:Lerp(self.WaistCFrame1, Delta10)
  379.  
  380. local lowercf = lowercf
  381.  
  382. do -- Right Leg
  383. local hipcf=(rootcf*RightHipCFrame)
  384. local hip =hipcf.Position
  385. local desiredPos =(hipcf*RightIdleCFrame).Position
  386. local offset =(desiredPos-hip)
  387. local raycastResult = workspace:Raycast(hip,offset.Unit*(offset.magnitude+1),RaycastParameters)
  388. local footPos = raycastResult and raycastResult.Position or (hip + offset.Unit*(offset.magnitude+self.RaycastOffset))
  389.  
  390. local plane,th1,th2 = SolveLegIK(lowercf*self.RightHipCFrame0,footPos, 0.55,1.15)
  391. self.RightHip.C0 = self.RightHip.C0:Lerp(lowercf:toObjectSpace(plane)*CFrame.Angles(th1,0,-HalfPi/8),Delta10)
  392. self.RightKnee.C0 = self.RightKnee.C0:Lerp(self.RightKneeCFrame0*CFrame.Angles(th2,0,0),Delta10)
  393. end
  394.  
  395. do -- Left Leg
  396. local hipcf = (rootcf*LeftHipCFrame)
  397. local hip = hipcf.Position
  398. local desiredPos = (hipcf*LeftIdleCFrame).Position
  399. local offset = (desiredPos-hip)
  400. local raycastResult = workspace:Raycast(hip,offset.Unit*(offset.magnitude+1),RaycastParameters)
  401. local footPos = raycastResult and raycastResult.Position or (hip + offset.Unit*(offset.magnitude+self.RaycastOffset))
  402.  
  403. local plane,th1,th2 = SolveLegIK(lowercf*self.LeftHipCFrame0,footPos, 0.55,1.15)
  404. self.LeftHip.C0 = self.LeftHip.C0:Lerp(lowercf:toObjectSpace(plane)*CFrame.Angles(th1,0,HalfPi/8),Delta10)
  405. self.LeftKnee.C0 = self.LeftKnee.C0:Lerp(self.LeftKneeCFrame0*CFrame.Angles(th2,0,0),Delta10)
  406. end
  407. end
  408. end)
  409. end
  410. e = Instance.new("RemoteEvent",owner.Character)
  411. local hed = Instance.new("Weld",owner.Character.Torso)
  412. hed.Part0 = owner.Character.Head
  413. hed.Part1 = hed.Parent
  414. hed.C0 = CFrame.new(0,-0.5,0)
  415. hed.C1 = CFrame.new(0,1,0)
  416. hed.Enabled = false
  417. local tool = Instance.new("Tool",owner.Backpack)
  418. tool.RequiresHandle = false
  419. tool.Name = "i have an obsession with ultrakill weapons please help im begging you"
  420. tool.ToolTip = "i have an obsession with ultrakill weapons please help im begging you save me from this i beg i need help please help im begging you please"
  421. tool.TextureId = "rbxassetid://11541198228"
  422. tool.Grip = CFrame.Angles(math.rad(180),0,0) * CFrame.new(0,-0.5,0.5)
  423. local part = Instance.new("Part",tool)
  424. part.CanCollide = false
  425. part.Size = Vector3.new(4.282, 15.101, 31.717) * 0.1
  426. part.Massless = true
  427. local weld = Instance.new("Weld",owner.Character["Right Arm"])
  428. weld.Part0 = part
  429. weld.Part1 = owner.Character["Right Arm"]
  430. weld.C1 = CFrame.Angles(math.rad(180 + -90),0,0) * CFrame.new(0,-0.25,1.5) * CFrame.Angles(math.rad(-2),math.rad(-2),0)
  431. local armw = Instance.new("Weld",owner.Character.Torso)
  432. armw.Part0 = owner.Character["Right Arm"]
  433. armw.Part1 = owner.Character.Torso
  434. armw.C1 = CFrame.new(1.5,0.4,0.25)
  435. armw.Enabled = false
  436. armw.C0 = CFrame.new(0,0.5,0) * CFrame.Angles(math.rad(-90),0,0)
  437. local tweenService = game:GetService("TweenService")
  438. local tweenInfo = TweenInfo.new(0.1,Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
  439. local goal = {}
  440. goal.C0 = CFrame.Angles(math.rad(-120),0,0)
  441. local tween = tweenService:Create(weld, tweenInfo, goal)
  442. local goal4 = {}
  443. goal4.C1 = CFrame.Angles(math.rad(180 + -90),0,0) * CFrame.new(0,-0.75,1.5) * CFrame.Angles(math.rad(-2),math.rad(-2),0)
  444. local tween4 = tweenService:Create(weld, tweenInfo, goal4)
  445. local tweenInfo = TweenInfo.new(0.15,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
  446. local goal2 = {}
  447. goal2.C0 = CFrame.Angles(math.rad(-240),0,0)
  448. local tween2 = tweenService:Create(weld, tweenInfo, goal2)
  449. local goal5 = {}
  450. goal5.C1 = CFrame.Angles(math.rad(180 + -90),0,0) * CFrame.new(0,-1.25,1.25) * CFrame.Angles(math.rad(-2),math.rad(-2),0)
  451. local tween5 = tweenService:Create(weld, tweenInfo, goal5)
  452. local tweenInfo = TweenInfo.new(0.1,Enum.EasingStyle.Quad,Enum.EasingDirection.In)
  453. local goal3 = {}
  454. goal3.C0 = CFrame.Angles(math.rad(-360),0,0)
  455. local tween3 = tweenService:Create(weld, tweenInfo, goal3)
  456. local goal6 = {}
  457. goal6.C1 = CFrame.Angles(math.rad(180 + -90),0,0) * CFrame.new(0,-0.25,1.5) * CFrame.Angles(math.rad(-2),math.rad(-2),0)
  458. local tween6 = tweenService:Create(weld, tweenInfo, goal6)
  459. local m = Instance.new("SpecialMesh",part)
  460. m.MeshId = "rbxassetid://7371059530"
  461. m.TextureId = "rbxassetid://10522947294"
  462. m.Scale = Vector3.new(1,1,1) * -0.1
  463. m.Offset = Vector3.new(0,0,0.5)
  464. local part2 = Instance.new("Part",tool)
  465. part2.CanCollide = false
  466. part2.Size = Vector3.new(4.282, 15.101, 31.717) * 0.1
  467. part2.Massless = true
  468. local weld2 = Instance.new("Weld",owner.Character["Left Arm"])
  469. weld2.Part0 = part2
  470. weld2.Part1 = owner.Character["Left Arm"]
  471. weld2.C1 = CFrame.Angles(math.rad(180 + -90),0,0) * CFrame.new(0,-0.25,1.5) * CFrame.Angles(math.rad(-2),math.rad(2),0)
  472. local armw2 = Instance.new("Weld",owner.Character.Torso)
  473. armw2.Part0 = owner.Character["Left Arm"]
  474. armw2.Part1 = owner.Character.Torso
  475. armw2.C1 = CFrame.new(-1.5,0.4,0.25)
  476. armw2.Enabled = false
  477. armw2.C0 = CFrame.new(0,0.5,0) * CFrame.Angles(math.rad(-90),0,0)
  478. local tweenService = game:GetService("TweenService")
  479. local tweenInfo = TweenInfo.new(0.1,Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
  480. local goal12 = {}
  481. goal12.C0 = CFrame.Angles(math.rad(-120),0,0)
  482. local tween12 = tweenService:Create(weld2, tweenInfo, goal12)
  483. local goal42 = {}
  484. goal42.C1 = CFrame.Angles(math.rad(180 + -90),0,0) * CFrame.new(0,-0.75,1.5) * CFrame.Angles(math.rad(-2),math.rad(2),0)
  485. local tween42 = tweenService:Create(weld2, tweenInfo, goal42)
  486. local tweenInfo = TweenInfo.new(0.15,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
  487. local goal22 = {}
  488. goal22.C0 = CFrame.Angles(math.rad(-240),0,0)
  489. local tween22 = tweenService:Create(weld2, tweenInfo, goal22)
  490. local goal52 = {}
  491. goal52.C1 = CFrame.Angles(math.rad(180 + -90),0,0) * CFrame.new(0,-1.25,1.25) * CFrame.Angles(math.rad(-2),math.rad(2),0)
  492. local tween52 = tweenService:Create(weld2, tweenInfo, goal52)
  493. local tweenInfo = TweenInfo.new(0.1,Enum.EasingStyle.Quad,Enum.EasingDirection.In)
  494. local goal32 = {}
  495. goal32.C0 = CFrame.Angles(math.rad(-360),0,0)
  496. local tween32 = tweenService:Create(weld2, tweenInfo, goal32)
  497. local goal62 = {}
  498. goal62.C1 = CFrame.Angles(math.rad(180 + -90),0,0) * CFrame.new(0,-0.25,1.5) * CFrame.Angles(math.rad(-2),math.rad(2),0)
  499. local tween62 = tweenService:Create(weld2, tweenInfo, goal62)
  500. local tweenInfo = TweenInfo.new(0.2,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,true)
  501. local goal = {}
  502. goal.C0 = CFrame.new(0,0.5,0.2) * CFrame.Angles(math.rad(-100),0,0)
  503. local twee = tweenService:Create(armw, tweenInfo, goal)
  504. local twee2 = tweenService:Create(armw2, tweenInfo, goal)
  505. local tweenInfo = TweenInfo.new(0.15,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,true)
  506. local goal = {}
  507. goal.C0 = CFrame.new(0,-0.1,0.2) * CFrame.Angles(math.rad(-110),0,0)
  508. local tweee = tweenService:Create(armw, tweenInfo, goal)
  509. local tweee2 = tweenService:Create(armw2, tweenInfo, goal)
  510. local goal = {}
  511. goal.C1 = CFrame.Angles(math.rad(180 + -90),0,0) * CFrame.new(0,-0.5,1.25) * CFrame.Angles(math.rad(14),math.rad(-2),0)
  512. local tweeee = tweenService:Create(weld, tweenInfo, goal)
  513. local goal = {}
  514. goal.C1 = CFrame.Angles(math.rad(180 + -90),0,0) * CFrame.new(0,-0.5,1.25) * CFrame.Angles(math.rad(14),math.rad(2),0)
  515. local tweeee2 = tweenService:Create(weld2, tweenInfo, goal)
  516. local welll = Instance.new("Weld",owner.Character.HumanoidRootPart)
  517. welll.Part0 = owner.Character.Torso
  518. welll.Part1 = owner.Character.HumanoidRootPart
  519. welll.C0 = CFrame.new(0,-0.75,0)
  520. welll.C1 = CFrame.new(0,-0.75,0)
  521. welll.Enabled = false
  522. local tweenInfo = TweenInfo.new(0.1,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,true)
  523. local goa = {}
  524. goa.C1 = welll.C1 * CFrame.Angles(math.rad(-5),0,0)
  525. local tweee3 = tweenService:Create(welll, tweenInfo, goa)
  526. local m2 = Instance.new("SpecialMesh",part2)
  527. m2.MeshId = "rbxassetid://7371059530"
  528. m2.TextureId = "rbxassetid://10522947294"
  529. m2.Scale = Vector3.new(1,1,1) * -0.1
  530. m2.Offset = Vector3.new(0,0,0.5)
  531. local equip = Instance.new("Sound")
  532. equip.PlayOnRemove = true
  533. equip.Volume = 1
  534. local m = Instance.new("Sound",part)
  535. m.Volume = 0.7
  536. m.SoundId = "rbxassetid://1838457617"
  537. m.Looped = true
  538. local shotcount = 24
  539. equip.SoundId = "rbxassetid://6870002623"
  540. local reload = false
  541. tween.Completed:Connect(function()
  542. tween2:Play()
  543. tween5:Play()
  544. tween22:Play()
  545. tween52:Play()
  546. end)
  547. tween2.Completed:Connect(function()
  548. tween3:Play()
  549. tween6:Play()
  550. tween32:Play()
  551. tween62:Play()
  552. end)
  553. tween62.Completed:Connect(function()
  554. wait(0.05)
  555. reload = false
  556. shotcount = 0
  557. end)
  558. tool.Equipped:Connect(function()
  559. equip.Parent = part
  560. equip.Parent = nil
  561. m:Play()
  562. end)
  563. tool.Equipped:Connect(function()
  564. reload = true
  565. armw.Enabled = true
  566. armw2.Enabled = true
  567. hed.Enabled = true
  568. tween:Play()
  569. tween4:Play()
  570. tween12:Play()
  571. tween42:Play()
  572. twee:Play()
  573. twee2:Play()
  574. w.Enabled = true
  575. w2.Enabled = true
  576. welll.Enabled = true
  577. end)
  578. tool.Unequipped:Connect(function()
  579. armw.Enabled = false
  580. armw2.Enabled = false
  581. hed.Enabled = false
  582. w.Enabled = false
  583. w2.Enabled = false
  584. welll.Enabled = false
  585. shotcount = 24
  586. m:Pause()
  587. end)
  588. thepew = false
  589. tool.Activated:Connect(function()
  590. if not reload then
  591. thepew = true
  592. end
  593. end)
  594. tool.Deactivated:Connect(function()
  595. thepew = false
  596. end)
  597. e.OnServerEvent:Connect(function(_,cam,c1,alpha,hitcf,sw,wcs,shift)
  598. local lookvector = owner.Character.HumanoidRootPart.CFrame:toObjectSpace(cam).lookVector.unit
  599. local y = lookvector.y
  600. hed.C0 = hed.C0:Lerp(CFrame.new(0,-0.5,0) * CFrame.Angles(-y * 0.75,0,0),0.5)
  601. hed.C0 = hed.C0 * CFrame.Angles(sw.y,0,0)
  602. if shift then
  603. welll.C0 = welll.C0:Lerp(CFrame.new(0,-0.75,0) * CFrame.Angles(-y * 0.25,0,0) * CFrame.Angles(wcs.y / 9, wcs.x / 9,wcs.y / 9) * CFrame.Angles(0,sw.x,sw.x),0.5)
  604. if y > 0 then
  605. armw.C1 = armw.C1:Lerp(CFrame.new(1.5,0.4,0) * CFrame.Angles(y * 0.75 + sw.y,-(sw.x),0) * CFrame.new(0,-0.5 * (y * 0.75),-0.5 * (y * 0.75)),0.5)
  606. armw.C1 = armw.C1:Lerp(armw.C1 * CFrame.new(wcs.y / 3, wcs.x / 3,0),0.25)
  607. armw2.C1 = armw2.C1:Lerp(CFrame.new(-1.5,0.4,0) * CFrame.Angles(y * 0.75 + sw.y,-(sw.x),0) * CFrame.new(0,-0.5 * (y * 0.75),-0.5 * (y * 0.75)),0.5)
  608. armw2.C1 = armw2.C1:Lerp(armw2.C1 * CFrame.new(wcs.y / 3, wcs.x / 3,0),0.25)
  609. else
  610. armw.C1 = armw.C1:Lerp(CFrame.new(1.5,0.4,0) * CFrame.Angles((y * 0.75) + sw.y,-(sw.x),0) * CFrame.new(0,0.5 * (y * 0.75),-0.5 * (y * 0.75)),0.5)
  611. armw.C1 = armw.C1:Lerp(armw.C1 * CFrame.new(wcs.y / 3, wcs.x / 3,0),0.25)
  612. armw2.C1 = armw2.C1:Lerp(CFrame.new(-1.5,0.4,0) * CFrame.Angles((y * 0.75) + sw.y,-(sw.x),0) * CFrame.new(0,0.5 * (y * 0.75),-0.5 * (y * 0.75)),0.5)
  613. armw2.C1 = armw2.C1:Lerp(armw2.C1 * CFrame.new(wcs.y / 3, wcs.x / 3,0),0.25)
  614. end
  615. else
  616. welll.C0 = welll.C0:Lerp(CFrame.new(0,-0.75,0) * CFrame.Angles(-y * 0.25,0,0) * CFrame.Angles(wcs.y / 9, wcs.x / 9,wcs.y / 9),0.5)
  617. if y > 0 then
  618. armw.C1 = armw.C1:Lerp(CFrame.new(1.5,0.4,0) * CFrame.Angles((y * 0.75) + sw.y,0,0) * CFrame.new(0,-0.5 * (y * 0.75),-0.5 * (y * 0.75)),0.5)
  619. armw.C1 = armw.C1:Lerp(armw.C1 * CFrame.new(wcs.y / 3, wcs.x / 3,0),0.25)
  620. armw2.C1 = armw2.C1:Lerp(CFrame.new(-1.5,0.4,0) * CFrame.Angles((y * 0.75) + sw.y,0,0) * CFrame.new(0,-0.5 * (y * 0.75),-0.5 * (y * 0.75)),0.5)
  621. armw2.C1 = armw2.C1:Lerp(armw2.C1 * CFrame.new(wcs.y / 3, wcs.x / 3,0),0.25)
  622. else
  623. armw.C1 = armw.C1:Lerp(CFrame.new(1.5,0.4,0) * CFrame.Angles((y * 0.75) + sw.y,0,0) * CFrame.new(0,0.5 * (y * 0.75),-0.5 * (y * 0.75)),0.5)
  624. armw.C1 = armw.C1:Lerp(armw.C1 * CFrame.new(wcs.y / 3, wcs.x / 3,0),0.25)
  625. armw2.C1 = armw2.C1:Lerp(CFrame.new(-1.5,0.4,0) * CFrame.Angles((y * 0.75) + sw.y,0,0) * CFrame.new(0,0.5 * (y * 0.75),-0.5 * (y * 0.75)),0.5)
  626. armw2.C1 = armw2.C1:Lerp(armw2.C1 * CFrame.new(wcs.y / 3, wcs.x / 3,0),0.25)
  627. end
  628. end
  629. end)
  630. NLS([[
  631. e = script.Parent
  632. local tool = owner.Backpack:WaitForChild("i have an obsession with ultrakill weapons please help im begging you")
  633. local ITERATIONS = 8
  634. local SPRING = {}
  635. function SPRING.create(self, mass, force, damping, speed)
  636. local spring = {
  637. Target = Vector3.new();
  638. Position = Vector3.new();
  639. Velocity = Vector3.new();
  640. Mass = mass or 5;
  641. Force = force or 50;
  642. Damping = damping or 4;
  643. Speed = speed or 4;
  644. }
  645. function spring.shove(self, force)
  646. local x, y, z = force.X, force.Y, force.Z
  647. if x ~= x or x == math.huge or x == -math.huge then
  648. x = 0
  649. end
  650. if y ~= y or y == math.huge or y == -math.huge then
  651. y = 0
  652. end
  653. if z ~= z or z == math.huge or z == -math.huge then
  654. z = 0
  655. end
  656. self.Velocity = self.Velocity + Vector3.new(x, y, z)
  657. end
  658. function spring.update(self, dt)
  659. local scaledDeltaTime = math.min(dt,1) * self.Speed / ITERATIONS
  660. for i = 1, ITERATIONS do
  661. local iterationForce = self.Target - self.Position
  662. local acceleration = (iterationForce * self.Force) / self.Mass
  663. acceleration = acceleration - (self.Velocity * self.Damping)
  664. self.Velocity = self.Velocity + (acceleration * scaledDeltaTime)
  665. self.Position = self.Position + (self.Velocity * scaledDeltaTime)
  666. end
  667. return self.Position
  668. end
  669. return spring
  670. end
  671. local wc = SPRING.create()
  672. local sway = SPRING.create()
  673. local bobspeed = 1
  674. local bobmod = .1
  675. local alpha = .25
  676. local hitcf = CFrame.new()
  677. local function gb(addition, speed, modifier)
  678. return math.sin(tick() * addition * speed) * modifier
  679. end
  680. c1 = CFrame.new(0,0,0)
  681. c2 = CFrame.new(0,0,0)
  682. local UIS = game:GetService("UserInputService")
  683. shift = false
  684. UIS:GetPropertyChangedSignal("MouseBehavior"):Connect(function()
  685. if UIS.MouseBehavior == Enum.MouseBehavior.LockCenter then
  686. shift = true
  687. elseif UIS.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
  688. shift = false
  689. end
  690. end)
  691. local mouse = owner:GetMouse()
  692. local part = Instance.new("Part",owner.Character.Head)
  693. part.Size = Vector3.new()
  694. part.CanCollide = false
  695. part.Transparency = 1
  696. local weld = Instance.new("Weld", owner.Character.Head)
  697. weld.Part0 = part
  698. weld.Part1 = owner.Character.Head
  699. weld.C0 = CFrame.new(0,-0.5,0.5)
  700. game:GetService("RunService").RenderStepped:Connect(function(dt)
  701. delta = game:GetService("UserInputService"):GetMouseDelta()
  702. local vel = owner.Character.HumanoidRootPart.Velocity
  703. local msway = Vector3.new(gb(10, bobspeed, bobmod), gb(5, bobspeed, bobmod), gb(5, bobspeed, bobmod))
  704. sway:shove(Vector3.new(delta.X / 500, delta.Y / 500))
  705. wc:shove((msway / 25) * dt * 60 * math.clamp(vel.Magnitude,0,30))
  706. local sw = sway:update(dt)
  707. local wcs = wc:update(dt)
  708. if shift == true and (owner.Character.Head.CFrame.Position - workspace.CurrentCamera.CFrame.Position).Magnitude < 1.5 then
  709. local x,_,z = owner.Character.HumanoidRootPart.CFrame:ToOrientation()
  710. local _,y,_ = workspace.CurrentCamera.CFrame:ToOrientation()
  711. owner.Character.HumanoidRootPart.CFrame = CFrame.new(owner.Character.HumanoidRootPart.Position) * CFrame.Angles(x,y,z)
  712. workspace.CurrentCamera.FieldOfView = 100
  713. for i,v in pairs(owner.Character:GetDescendants()) do
  714. if v:IsA("Part") or v:IsA("MeshPart") and v.Name ~= "Head" then
  715. v.LocalTransparencyModifier = 0
  716. end
  717. if v:IsA("Accessory") and (v.AccessoryType == Enum.AccessoryType.Hat or v.AccessoryType == Enum.AccessoryType.Hair or v.AccessoryType == Enum.AccessoryType.Face or v.AccessoryType == Enum.AccessoryType.Neck) and v.Handle ~= nil then
  718. v.Handle.Transparency = 1
  719. end
  720. end
  721. if owner.Character.Head.face ~= nil then
  722. owner.Character.Head.face.Transparency = 1
  723. end
  724. owner.Character.Head.Transparency = 1
  725. workspace.CurrentCamera.CameraSubject = part
  726. else
  727. workspace.CurrentCamera.FieldOfView = 70
  728. workspace.CurrentCamera.CameraSubject = owner.Character
  729. owner.Character.Head.Transparency = 0
  730. for i,v in pairs(owner.Character:GetDescendants()) do
  731. if v:FindFirstChildWhichIsA("SpecialMesh") then
  732. v.Transparency = 0
  733. end
  734. end
  735. if owner.Character.Head.face ~= nil then
  736. owner.Character.Head.face.Transparency = 0
  737. end
  738. end
  739. e:FireServer(workspace.CurrentCamera.CFrame,c1,alpha,hitcf,sw,wcs,shift)
  740. end)
  741. ]],e)
  742. wait()
  743. local IKProfile = IK_HANDLER.New(owner,1.5,10,0,0.5)
  744. wait()
  745. local Heartbeat = game:GetService("RunService").Heartbeat
  746. time = 1 + Heartbeat:Wait()
  747. lr = false
  748. coroutine.wrap(function()
  749. while game:GetService("RunService").Stepped:Wait() do
  750. if thepew and shotcount ~= 24 then
  751. shotcount += 1
  752. local muzzle = Instance.new("Part",script)
  753. muzzle.CanCollide = false
  754. muzzle.CanQuery = false
  755. muzzle.Anchored = true
  756. s.Parent = muzzle
  757. s.Parent = nil
  758. if shotcount >= 22 then
  759. s.PlaybackSpeed = Random.new():NextNumber(0.95,1.05) + (0.15 * (shotcount - 21))
  760. else
  761. s.PlaybackSpeed = Random.new():NextNumber(0.95,1.05)
  762. end
  763. tweee3:Play()
  764. if lr == true then
  765. muzzle.CFrame = part.CFrame * CFrame.new(0,-0.35,1.9)
  766. muzzle.Position = muzzle.Position + part.Velocity * owner:GetNetworkPing()
  767. tweee:Play()
  768. tweeee:Play()
  769. else
  770. muzzle.CFrame = part2.CFrame * CFrame.new(0,-0.35,1.9)
  771. muzzle.Position = muzzle.Position + part2.Velocity * owner:GetNetworkPing()
  772. tweee2:Play()
  773. tweeee2:Play()
  774. end
  775. muzzle.Transparency = 1
  776. local attachment0 = Instance.new("Attachment")
  777. attachment0.Parent = muzzle
  778. local attachment1 = Instance.new("Attachment")
  779. attachment1.Parent = workspace.Terrain
  780. attachment1.WorldCFrame = attachment0.WorldCFrame
  781. local params = RaycastParams.new()
  782. params.FilterDescendantsInstances = {owner.Character,script}
  783. params.FilterType = Enum.RaycastFilterType.Blacklist
  784. local res = workspace:Raycast(owner.Character.Head.Position + owner.Character.Head.Velocity * owner:GetNetworkPing(),owner.Character.Head.CFrame.lookVector * 5000, params)
  785. local muzzle2 = Instance.new("Part",script)
  786. muzzle2.CanQuery = false
  787. muzzle2.CanCollide = false
  788. muzzle2.Size = Vector3.new(0.1,0.1,0.1)
  789. muzzle2.Anchored = true
  790. muzzle2.Transparency = 1
  791. local pe = Instance.new("ParticleEmitter",muzzle2)
  792. pe.Texture = "rbxassetid://13191594"
  793. pe.Enabled = false
  794. pe.Speed = NumberRange.new(5,10)
  795. pe.Shape = "Cylinder"
  796. pe.ShapeStyle = "Volume"
  797. pe.ShapeInOut = "Outward"
  798. pe.LightEmission = 0.2
  799. pe.LightInfluence = 0.5
  800. pe.Size = NumberSequence.new{NumberSequenceKeypoint.new(0, 0.125),NumberSequenceKeypoint.new(1, 0.0625)}
  801. pe.Lifetime = NumberRange.new(0.5, 0.75)
  802. pe.Rate = 500
  803. pe.Drag = 2
  804. pe.LockedToPart = true
  805. pe.RotSpeed = NumberRange.new(0,0)
  806. pe.Color = ColorSequence.new(Color3.fromRGB(242, 191, 24))
  807. pe.SpreadAngle = Vector2.new(-20, 20)
  808. pe.EmissionDirection = Enum.NormalId.Back
  809. pe.Acceleration = Vector3.new(0,-50,0)
  810. game:GetService("Debris"):AddItem(muzzle2,1)
  811. local beam = Instance.new("Beam")
  812. beam.Width0 = 0.25
  813. beam.Width1 = 0.2
  814. local p = nil
  815. if res then
  816. p = CFrame.new(res.Position)
  817. if res.Instance:FindFirstAncestorWhichIsA("Model") and res.Instance:FindFirstAncestorWhichIsA("Model"):FindFirstChild("Humanoid") then
  818. res.Instance:FindFirstAncestorWhichIsA("Model"):FindFirstChild("Humanoid").Health -= 15
  819. muzzle2.CFrame = CFrame.new(res.Position) * CFrame.Angles(CFrame.new(muzzle.Position,res.Position):ToEulerAnglesXYZ()) * CFrame.Angles(0,math.rad(90),0)
  820. pe.Color = ColorSequence.new(Color3.fromRGB(222, 10, 7))
  821. else
  822. muzzle2.CFrame = CFrame.new(res.Position) * CFrame.Angles(CFrame.new(muzzle.Position,res.Position):ToEulerAnglesXYZ()) * CFrame.Angles(0,math.rad(90),0)
  823. pe.Color = ColorSequence.new(Color3.fromRGB(242, 191, 24))
  824. end
  825. else
  826. p = owner.Character.Head.CFrame * CFrame.new(0,0,-7000)
  827. muzzle2:Destroy()
  828. beam.Width1 = 0.125
  829. end
  830. beam.Attachment0 = attachment0
  831. beam.Attachment1 = attachment1
  832. beam.CurveSize0 = 0
  833. beam.CurveSize1 = 0
  834. beam.FaceCamera = true
  835. beam.LightInfluence = 0
  836. beam.Segments = 10
  837. beam.LightEmission = 1
  838. beam.Brightness = 0.8
  839. beam.Color = ColorSequence.new{ColorSequenceKeypoint.new(0, Color3.fromRGB(242, 191, 24)),ColorSequenceKeypoint.new(1, Color3.fromRGB(252, 227, 0))}
  840. beam.Transparency = NumberSequence.new{NumberSequenceKeypoint.new(0, 0.9),NumberSequenceKeypoint.new(1, 0.9)}
  841. local billboard = Instance.new("BillboardGui", muzzle)
  842. billboard.Size = UDim2.new(2.5,0,2.5,0)
  843. local frame = Instance.new("ImageLabel", billboard)
  844. frame.BackgroundTransparency = 1
  845. frame.ImageTransparency = 0
  846. frame.Image = "http://www.roblox.com/asset/?id=11467328624"
  847. frame.Size = UDim2.new(1,0,1,0)
  848. local gg = {}
  849. gg.WorldCFrame = p
  850. local tweenInfoo = TweenInfo.new(0.13,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
  851. local tttt = tweenService:Create(attachment1, tweenInfoo, gg)
  852. tttt:Play()
  853. coroutine.wrap(function()
  854. tttt.Completed:Wait()
  855. if pe ~= nil then
  856. pe:Emit(20)
  857. end
  858. end)()
  859. local gg = {}
  860. gg.Rotation = math.random(-50,50)
  861. gg.ImageTransparency = 1
  862. local tweenInfoo = TweenInfo.new(0.3,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
  863. local ttttt = tweenService:Create(frame, tweenInfoo, gg)
  864. ttttt:Play()
  865. local g = {}
  866. g.Width0 = 0.1
  867. g.Width1 = 0.1
  868. g.Brightness = 0.2
  869. local tweenInfo = TweenInfo.new(0.15,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
  870. local t = tweenService:Create(beam, tweenInfo, g)
  871. coroutine.wrap(function()
  872. for i = -1,100,1 do
  873. wait(0.001)
  874. beam.Transparency = NumberSequence.new{NumberSequenceKeypoint.new(0, (0.072 * i)),NumberSequenceKeypoint.new(1, (0.072 * i))}
  875. end
  876. end)()
  877. beam.Parent = muzzle
  878. coroutine.wrap(function()
  879. local gg = {}
  880. gg.CFrame = CFrame.new()
  881. local waittt = TweenInfo.new(0.3,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
  882. local waitt = tweenService:Create(pppp, waittt, gg)
  883. waitt:Play()
  884. waitt.Completed:Wait()
  885. lr = not lr
  886. end)()
  887. local gg = {}
  888. gg.CFrame = CFrame.new()
  889. local waittt = TweenInfo.new(0.15,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
  890. local waitt = tweenService:Create(pppp, waittt, gg)
  891. waitt:Play()
  892. waitt.Completed:Wait()
  893. t:Play()
  894. local gg = {}
  895. gg.CFrame = CFrame.new()
  896. local waittt = TweenInfo.new(0.15,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
  897. local waitt = tweenService:Create(pppp, waittt, gg)
  898. waitt:Play()
  899. waitt.Completed:Wait()
  900. game:GetService("Debris"):AddItem(muzzle,0.3)
  901. elseif thepew and shotcount == 24 and not reload then
  902. reload = true
  903. tween:Play()
  904. tween4:Play()
  905. tween12:Play()
  906. tween42:Play()
  907. twee:Play()
  908. twee2:Play()
  909. end
  910. end
  911. end)()
  912. owner.Character.Humanoid.StateChanged:Connect(function(old, new)
  913. if tool.Parent == owner.Character then
  914. if new == Enum.HumanoidStateType.Seated or new == Enum.HumanoidStateType.PlatformStanding then
  915. w.Enabled = false
  916. w2.Enabled = false
  917. elseif (old == Enum.HumanoidStateType.Seated and new ~= Enum.HumanoidStateType.PlatformStanding) or (old == Enum.HumanoidStateType.PlatformStanding and new ~= Enum.HumanoidStateType.Seated) then
  918. w.Enabled = true
  919. w2.Enabled = true
  920. end
  921. end
  922. end)
  923. while task.wait() do
  924. if IKProfile:IsActive() then
  925. IKProfile:Update()
  926. end
  927. end
Add Comment
Please, Sign In to add comment