Advertisement
sIendytubble

distraction dance fleeing the complex

Aug 16th, 2020 (edited)
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.47 KB | None | 0 0
  1. -- thanks dark! (Dark Eccentric)
  2. -- all this does is basically make you dance the distraction dance from
  3. -- fleeing the complex
  4. -- but theres more!
  5. -- click a player or npc (needs R6)
  6. -- to make them dance
  7. -- it basically makes them not able to control their character lol
  8. -- alr have fun using this i guess
  9. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  10. local Player,game,owner = owner,game
  11. local RealPlayer = Player
  12. do
  13. print("FE Compatibility code by Mokiros")
  14. local rp = RealPlayer
  15. script.Parent = rp.Character
  16.  
  17. --RemoteEvent for communicating
  18. local Event = Instance.new("RemoteEvent")
  19. Event.Name = "UserInput_Event"
  20.  
  21. --Fake event to make stuff like Mouse.KeyDown work
  22. local function fakeEvent()
  23. local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  24. t.connect = t.Connect
  25. return t
  26. end
  27.  
  28. --Creating fake input objects with fake variables
  29. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  30. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  31. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  32. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  33. end}
  34. --Merged 2 functions into one by checking amount of arguments
  35. CAS.UnbindAction = CAS.BindAction
  36.  
  37. --This function will trigger the events that have been :Connect()'ed
  38. local function te(self,ev,...)
  39. local t = m[ev]
  40. if t and t._fakeEvent then
  41. for _,f in pairs(t.Functions) do
  42. f(...)
  43. end
  44. end
  45. end
  46. m.TrigEvent = te
  47. UIS.TrigEvent = te
  48.  
  49. Event.OnServerEvent:Connect(function(plr,io)
  50. if plr~=rp then return end
  51. m.Target = io.Target
  52. m.Hit = io.Hit
  53. if not io.isMouse then
  54. local b = io.UserInputState == Enum.UserInputState.Begin
  55. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  56. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  57. end
  58. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  59. return m:TrigEvent(b and "Button2Down" or "Button2Up")
  60. end
  61. for _,t in pairs(CAS.Actions) do
  62. for _,k in pairs(t.Keys) do
  63. if k==io.KeyCode then
  64. t.Function(t.Name,io.UserInputState,io)
  65. end
  66. end
  67. end
  68. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  69. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  70. end
  71. end)
  72. Event.Parent = NLS([==[
  73. local Player = game:GetService("Players").LocalPlayer
  74. local Event = script:WaitForChild("UserInput_Event")
  75. local Mouse = Player:GetMouse()
  76. local UIS = game:GetService("UserInputService")
  77. local input = function(io,a)
  78. if a then return end
  79. --Since InputObject is a client-side instance, we create and pass table instead
  80. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  81. end
  82. UIS.InputBegan:Connect(input)
  83. UIS.InputEnded:Connect(input)
  84. local h,t
  85. --Give the server mouse data 30 times every second, but only if the values changed
  86. --If player is not moving their mouse, client won't fire events
  87. while wait(1/30) do
  88. if h~=Mouse.Hit or t~=Mouse.Target then
  89. h,t=Mouse.Hit,Mouse.Target
  90. Event:FireServer({isMouse=true,Target=t,Hit=h})
  91. end
  92. end]==],Player.Character)
  93.  
  94. ----Sandboxed game object that allows the usage of client-side methods and services
  95. --Real game object
  96. local _rg = game
  97.  
  98. --Metatable for fake service
  99. local fsmt = {
  100. __index = function(self,k)
  101. local s = rawget(self,"_RealService")
  102. if s then
  103. return typeof(s[k])=="function"
  104. and function(_,...)return s[k](s,...)end or s[k]
  105. end
  106. end,
  107. __newindex = function(self,k,v)
  108. local s = rawget(self,"_RealService")
  109. if s then s[k]=v end
  110. end
  111. }
  112. local function FakeService(t,RealService)
  113. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  114. return setmetatable(t,fsmt)
  115. end
  116.  
  117. --Fake game object
  118. local g = {
  119. GetService = function(self,s)
  120. return rawget(self,s) or _rg:GetService(s)
  121. end,
  122. Players = FakeService({
  123. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  124. },"Players"),
  125. UserInputService = FakeService(UIS,"UserInputService"),
  126. ContextActionService = FakeService(CAS,"ContextActionService"),
  127. RunService = FakeService({
  128. _btrs = {},
  129. RenderStepped = _rg:GetService("RunService").Heartbeat,
  130. BindToRenderStep = function(self,name,_,fun)
  131. self._btrs[name] = self.Heartbeat:Connect(fun)
  132. end,
  133. UnbindFromRenderStep = function(self,name)
  134. self._btrs[name]:Disconnect()
  135. end,
  136. },"RunService")
  137. }
  138. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  139. g.service = g.GetService
  140. FakeService(g,game)
  141. --Changing owner to fake player object to support owner:GetMouse()
  142. game,owner = g,g.Players.LocalPlayer
  143. end
  144. char = owner.Character
  145. local dummy5leg1 = CFrame.new(0.8,-1,-0.5) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(15))
  146. local dummy5leg2 = CFrame.new(-0.8,-2,-0.2) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(-15))
  147. local dummy5arm1 = CFrame.new(-0.9,0.5,-0.6) * CFrame.Angles(math.rad(90),math.rad(0),math.rad(-90))
  148. local dummy5arm2 = CFrame.new(-1.2,0.5,0.1) * CFrame.Angles(math.rad(90),math.rad(0),math.rad(-90))
  149.  
  150. local dummy4leg1 = CFrame.new(0.8,-2,-0.2) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(15))
  151. local dummy4leg2 = CFrame.new(-0.8,-1,-0.5) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(-15))
  152. local dummy4arm1 = CFrame.new(-1.2,0.5,0.3) * CFrame.Angles(math.rad(90),math.rad(0),math.rad(-90))
  153. local dummy4arm2 = CFrame.new(-0.3,0.5,-0.8) * CFrame.Angles(math.rad(90),math.rad(0),math.rad(-90))
  154.  
  155. local dummy3leg1 = CFrame.new(0.8,-1,-0.4) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(15))
  156. local dummy3leg2 = CFrame.new(-0.8,-2,-0.2) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(-15))
  157. local dummy3arm1 = CFrame.new(1,0,-0.4) * CFrame.Angles(math.rad(30),math.rad(0),math.rad(-55))
  158. local dummy3arm2 = CFrame.new(-1,0,-0.4) * CFrame.Angles(math.rad(30),math.rad(0),math.rad(55))
  159.  
  160. local dummy2leg1 = CFrame.new(0.8,-1,-0.4) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(14))
  161. local dummy2leg2 = CFrame.new(-0.8,-2,-0.2) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(-14))
  162. local dummy2arm1 = CFrame.new(1.5,0,-0.2) * CFrame.Angles(math.rad(25),math.rad(0),math.rad(45))
  163. local dummy2arm2 = CFrame.new(-1.5,0,-0.2) * CFrame.Angles(math.rad(25),math.rad(0),math.rad(-45))
  164. distract = Instance.new("Sound",char.Torso)
  165. distract.Volume = 5
  166. distract.SoundId = "rbxassetid://5549004857"
  167. distract.Looped = true
  168. distract:Play()
  169. limbs = {char["Left Leg"],char["Left Arm"],char["Right Arm"],char["Right Leg"]}
  170. function weld(part,part0,part1)
  171. h = Instance.new("Weld",part)
  172. h.Name = "distractionweld"
  173. h.Part0 = part0
  174. h.Part1 = part1
  175. return h
  176. end
  177. d2 = false
  178. d3 = false
  179. d4 = false
  180. d5 = false
  181. function lerp(weld,c0)
  182. weld.C0 = weld.C0:lerp(c0,0.25)
  183. end
  184. distractedlist = {}
  185. function distraction(player)
  186. hu = player:FindFirstChildOfClass("Humanoid")
  187.  
  188. if hu.RigType == Enum.HumanoidRigType.R15 then return end
  189. hu.WalkSpeed = 0
  190. hu.AutoRotate = false
  191. hu.JumpPower = 0
  192. for i,v in pairs(player:GetChildren()) do
  193. if v.ClassName == "Part" and v.Name ~= "Torso" and v.Name ~= "HumanoidRootPart" and v.Name ~= "Head" then
  194. weld(v,player.Torso,v)
  195. end
  196. end
  197. table.insert(distractedlist,player)
  198. end
  199. lleg = weld(limbs[1],char.Torso,limbs[1])
  200. rleg = weld(limbs[4],char.Torso,limbs[4])
  201. rarm = weld(limbs[3],char.Torso,limbs[3])
  202. larm = weld(limbs[2],char.Torso,limbs[2])
  203. leg1 = false
  204. leg2 = false
  205. game:GetService("RunService").Stepped:Connect(function()
  206. if leg1 == true then
  207. lerp(rleg,dummy5leg1)
  208. else
  209. lerp(rleg,dummy4leg1)
  210. end
  211. if leg2 == true then
  212. lerp(lleg,dummy4leg2)
  213. else
  214. lerp(lleg,dummy5leg2)
  215. end
  216. if d2 == true then
  217. lerp(rarm,dummy2arm1)
  218. lerp(larm,dummy2arm2)
  219. end
  220. if d3 == true then
  221. lerp(rarm,dummy3arm1)
  222. lerp(larm,dummy3arm2)
  223. end
  224. if d4 == true then
  225. lerp(larm,dummy4arm1)
  226. lerp(rarm,dummy4arm2)
  227. end
  228. if d5 == true then
  229. lerp(larm,dummy5arm1)
  230. lerp(rarm,dummy5arm2)
  231. end
  232. for i,v in pairs(distractedlist) do
  233. if v ~= nil then
  234. for i,limb in pairs(v:GetDescendants()) do
  235. if limb:FindFirstChild("distractionweld") then
  236. doh = limb:FindFirstChild("distractionweld")
  237. for i,limb2 in pairs(char:GetDescendants()) do
  238. if limb2.Name == doh.Parent.Name and limb2:FindFirstChild(doh.Name) then
  239. doh.C0 = limb2[doh.Name].C0
  240. end
  241. end
  242. end
  243. end
  244. end
  245. end
  246. end)
  247. mouse = owner:GetMouse()
  248. mouse.Button1Down:Connect(function()
  249. target = mouse.Target
  250. if target.Parent ~= nil and target.Parent ~= workspace and target.Parent:FindFirstChildOfClass("Humanoid") and target.Parent:FindFirstChildOfClass("Humanoid").Name ~= "dancedistraction" then
  251. distraction(target.Parent)
  252. end
  253. end)
  254. coroutine.resume(coroutine.create(function()
  255. while wait(0.20) do
  256. d2 = true
  257. d3 = false
  258. d4 = false
  259. d5 = false
  260. wait(0.20)
  261. d2 = false
  262. d3 = true
  263. d4 = false
  264. d5 = false
  265. wait(0.20)
  266. d2 = true
  267. d3 = false
  268. d4 = false
  269. d5 = false
  270. wait(0.38)
  271. d2 = false
  272. d3 = false
  273. d4 = true
  274. d5 = false
  275. wait(0.3)
  276. d2 = false
  277. d3 = false
  278. d4 = false
  279. d5 = true
  280. end
  281. end))
  282. coroutine.resume(coroutine.create(function()
  283. while wait(0.20) do
  284. leg1 = true
  285. leg2 = false
  286. wait(0.20)
  287. leg1 = false
  288. leg2 = true
  289. end
  290. end))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement