DrakerMaker

Shatter W.I.P.

Nov 13th, 2019 (edited)
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.80 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  3. do
  4. script.Parent = Player.Character
  5.  
  6. --RemoteEvent for communicating
  7. local Event = Instance.new("RemoteEvent")
  8. Event.Name = "UserInput_Event"
  9.  
  10. --Fake event to make stuff like Mouse.KeyDown work
  11. local function fakeEvent()
  12. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  13. t.connect = t.Connect
  14. return t
  15. end
  16.  
  17. --Creating fake input objects with fake variables
  18. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  19. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  20. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  21. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  22. end}
  23. --Merged 2 functions into one by checking amount of arguments
  24. CAS.UnbindAction = CAS.BindAction
  25.  
  26. --This function will trigger the events that have been :Connect()'ed
  27. local function te(self,ev,...)
  28. local t = m[ev]
  29. if t and t._fakeEvent and t.Function then
  30. t.Function(...)
  31. end
  32. end
  33. m.TrigEvent = te
  34. UIS.TrigEvent = te
  35.  
  36. Event.OnServerEvent:Connect(function(plr,io)
  37. if plr~=Player then return end
  38. if io.isMouse then
  39. m.Target = io.Target
  40. m.Hit = io.Hit
  41. else
  42. local b = io.UserInputState == Enum.UserInputState.Begin
  43. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  44. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  45. end
  46. for _,t in pairs(CAS.Actions) do
  47. for _,k in pairs(t.Keys) do
  48. if k==io.KeyCode then
  49. t.Function(t.Name,io.UserInputState,io)
  50. end
  51. end
  52. end
  53. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  54. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  55. end
  56. end)
  57. Event.Parent = NLS([==[
  58. local Player = game:GetService("Players").LocalPlayer
  59. local Event = script:WaitForChild("UserInput_Event")
  60.  
  61. local UIS = game:GetService("UserInputService")
  62. local input = function(io,a)
  63. if a then return end
  64. --Since InputObject is a client-side instance, we create and pass table instead
  65. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  66. end
  67. UIS.InputBegan:Connect(input)
  68. UIS.InputEnded:Connect(input)
  69.  
  70. local Mouse = Player:GetMouse()
  71. local h,t
  72. --Give the server mouse data 30 times every second, but only if the values changed
  73. --If player is not moving their mouse, client won't fire events
  74. while wait(1/30) do
  75. if h~=Mouse.Hit or t~=Mouse.Target then
  76. h,t=Mouse.Hit,Mouse.Target
  77. Event:FireServer({isMouse=true,Target=t,Hit=h})
  78. end
  79. end]==],Player.Character)
  80. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  81. end
  82. function rayCast(Position, Direction, Range, Ignore)
  83. return game:service("Workspace"):FindPartOnRay(Ray.new(Position, Direction.unit * (Range or 999.999)), Ignore)
  84. end
  85. local Player_Size = 1
  86. function wbtwe(first,second,c0)
  87. local weld = Instance.new("Weld", first)
  88. weld.Part0 = first
  89. weld.Part1 = second
  90. weld.C0 = second.CFrame:inverse() *second.CFrame *c0
  91. return weld
  92. end
  93. hoodbounce = 1
  94. lwalk = 1
  95. rwalk = 1
  96. walk = 1
  97. animt = true
  98. deb = false
  99. hrw = wbtwe(owner.Character.Torso, owner.Character.HumanoidRootPart, CFrame.new(0, 0, 0))
  100. law = wbtwe(owner.Character["Left Arm"], owner.Character.Torso, CFrame.new(1.34, 0, 0) *CFrame.Angles(0, 25.1, 0))
  101. raw = wbtwe(owner.Character["Right Arm"], owner.Character.Torso, CFrame.new(-1.34, 1, 0.8) *CFrame.Angles(-1.5, 0, 0))
  102. llw = wbtwe(owner.Character["Left Leg"], owner.Character.HumanoidRootPart, CFrame.new(0.45, 2.1, 0) *CFrame.Angles(0, 25.1, 0))
  103. rlw = wbtwe(owner.Character["Right Leg"], owner.Character.HumanoidRootPart, CFrame.new(-0.4, 2.1, 0) *CFrame.Angles(0, 0, 0))
  104. hw = wbtwe(owner.Character.Head, owner.Character.Torso, CFrame.new(0, -1.5, 0) *CFrame.Angles(0, 0, 0.2))
  105. local sound = Instance.new("Sound", owner.Character.Head)
  106. sound.SoundId = "rbxassetid://1452402780"
  107. sound.Volume = 1
  108. sound.Looped = true
  109. sound:Play()
  110. local song = Instance.new("Sound", owner.Character.Head)
  111. song.SoundId = "rbxassetid://1837111398"
  112. song.Volume = 2
  113. song.Looped = true
  114. song:Play()
  115. local hood = Instance.new("Part", owner.Character.Head)
  116. hood.CanCollide = false
  117. hood.Size = Vector3.new(2, 2, 1.8)
  118. hood.BrickColor = BrickColor.new("Really black")
  119. local mesh = Instance.new("SpecialMesh", hood)
  120. mesh.MeshId = "http://www.roblox.com/asset/?id=76062497"
  121. mesh.Scale = Vector3.new(1.1, 1.1, 1.1)
  122. owner.Character.Head.face.Texture = "http://www.roblox.com/asset/?id=2099106175"
  123. hoodw = wbtwe(hood, owner.Character.Head, CFrame.new(0, 0, -0.1))
  124. anim = coroutine.wrap(function()
  125. while game:GetService("RunService").Stepped:wait() do
  126. if animt == true then
  127. if owner.Character.HumanoidRootPart.Velocity.Magnitude < 1 then
  128. llw.Part1 = owner.Character.HumanoidRootPart
  129. rlw.Part1 = owner.Character.HumanoidRootPart
  130. hoodbounce = hoodbounce +0.1
  131. hoodw.C0 = hoodw.C0:lerp(owner.Character.Head.CFrame:inverse() *owner.Character.Head.CFrame *CFrame.new(0, 0, -0.1), 0.4)
  132. hw.C0 = hw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0, -1.5, 0) *CFrame.Angles(math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1)), 0.2 +math.rad(math.random(-1, 1))), 0.1)
  133. hrw.C0 = hrw.C0:lerp(owner.Character.HumanoidRootPart.CFrame:inverse() *owner.Character.HumanoidRootPart.CFrame *CFrame.new(0, 1, 0) *CFrame.Angles(math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1))), 0.1)
  134. law.C0 = law.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(1.34, 0, 0) *CFrame.Angles(math.rad(math.random(-1, 1)), 25.1 +math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1))), 0.1)
  135. raw.C0 = raw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-1.34, 0.8, 0.3) *CFrame.Angles(-2.5 +math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1))), 0.1)
  136. llw.C0 = llw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0.34, 2.1, 1.2) *CFrame.Angles(1, 25.1, 0), 0.1)
  137. rlw.C0 = rlw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-0.34, 2.1, 0.8) *CFrame.Angles(0 +math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1))), 0.1)
  138. end
  139. if owner.Character.HumanoidRootPart.Velocity.Magnitude > 1 then
  140. llw.Part1 = owner.Character.HumanoidRootPart
  141. rlw.Part1 = owner.Character.HumanoidRootPart
  142. hitfloor, posfloor = rayCast(owner.Character.HumanoidRootPart.Position, CFrame.new(owner.Character.HumanoidRootPart.Position, owner.Character.HumanoidRootPart.Position - Vector3.new(0, 1, 0)).lookVector, 4 * Player_Size, owner.Character)
  143. if hitfloor then
  144. hoodbounce = hoodbounce +0.1
  145. lwalk = lwalk +0.05
  146. rwalk = rwalk +0.05
  147. walk = walk +0.1
  148. hoodw.C0 = hoodw.C0:lerp(owner.Character.Head.CFrame:inverse() *owner.Character.Head.CFrame *CFrame.new(0, math.cos(hoodbounce) *0.1, -0.1), 0.4)
  149. hw.C0 = hw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0, -1.5 +math.sin(hoodbounce) *0.1, 0) *CFrame.Angles(math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1)), 0.2, 0.5 +math.cos(hoodbounce) *0.4), 0.1)
  150. hrw.C0 = hrw.C0:lerp(owner.Character.HumanoidRootPart.CFrame:inverse() *owner.Character.HumanoidRootPart.CFrame *CFrame.new(0, 0, 0) *CFrame.Angles(math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1))), 0.1)
  151. law.C0 = law.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(1.34, 0, math.sin(-lwalk) *0.7) *CFrame.Angles(math.sin(lwalk) *0.7 +math.rad(math.random(-1, 1)), 25.1 +math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1))), 0.1)
  152. raw.C0 = raw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-1.34, 0, math.sin(-rwalk) *0.7) *CFrame.Angles(math.sin(rwalk) *0.7 +math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1))), 0.1)
  153. llw.C0 = llw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0.34, 2.1 +math.cos(lwalk) *0.3, math.sin(lwalk) *0.7) *CFrame.Angles(math.sin(lwalk) *0.9, 25.1, 0), 0.1)
  154. rlw.C0 = rlw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-0.34, 2.1 +math.cos(lwalk) *0.3, math.sin(-lwalk) *0.7) *CFrame.Angles(math.sin(-lwalk) *0.9+math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1)), math.rad(math.random(-1, 1))), 0.1)
  155. end
  156. if hitfloor == nil then
  157. hoodw.C0 = hoodw.C0:lerp(owner.Character.Head.CFrame:inverse() *owner.Character.Head.CFrame *CFrame.new(0, 0, -0.1), 0.4)
  158. llw.Part1 = owner.Character.Torso
  159. rlw.Part1 = owner.Character.Torso
  160. hw.C0 = hw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0, -1.5, 0) *CFrame.Angles(0, 0, 0), 0.05)
  161. hrw.C0 = hrw.C0:lerp(owner.Character.HumanoidRootPart.CFrame:inverse() *owner.Character.HumanoidRootPart.CFrame *CFrame.new(0, 0, 0) *CFrame.Angles(1.7, 0, 0), 0.05)
  162. law.C0 = law.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(1.34, 1, 0) *CFrame.Angles(1.5, 25.1, 0), 0.05)
  163. raw.C0 = raw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-1.34, 1, 0) *CFrame.Angles(1.5, 0, 0), 0.05)
  164. llw.C0 = llw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0.45, 2.1, 0)*CFrame.Angles(0, 25.1, 0), 0.05)
  165. rlw.C0 = rlw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-0.45, 2.1, 0) *CFrame.Angles(0, 0, 0), 0.05)
  166. end
  167. end
  168. end
  169. end
  170. end)anim()
  171. mouse.KeyDown:connect(function(k)
  172. if k == "k" then
  173. if deb == false then
  174. deb = true
  175. animt = false
  176. owner.Character.Humanoid.WalkSpeed = 6
  177. -- Held up
  178. for i = 0,1,0.1 do
  179. game:GetService("RunService").Stepped:wait()
  180. hrw.C0 = hrw.C0:lerp(owner.Character.HumanoidRootPart.CFrame:inverse() *owner.Character.HumanoidRootPart.CFrame *CFrame.new(0, 0, 0), 0.1)
  181. hw.C0 = hw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0, -1.5, 0), 0.1)
  182. law.C0 = law.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(1.34, 0, 0) *CFrame.Angles(0, 25.1, 0), 0.05)
  183. raw.C0 = raw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-1.34, 0, 0) *CFrame.Angles(0, 0, 0), 0.05)
  184. llw.C0 = llw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0.45, 2.1, 0)*CFrame.Angles(0, 25.1, 0), 0.05)
  185. rlw.C0 = rlw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-0.45, 2.1, 0) *CFrame.Angles(0, 0, 0), 0.05)
  186. end
  187. end
  188. end
  189. end
  190. end)
Add Comment
Please, Sign In to add comment