Advertisement
DarkScriptZEditors

Rag

Jan 9th, 2019
931
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.72 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,game,owner = owner,game
  3. local RealPlayer = Player
  4. do
  5. print("FE Compatibility code by Mokiros")
  6. local rp = RealPlayer
  7. script.Parent = rp.Character
  8.  
  9. --RemoteEvent for communicating
  10. local Event = Instance.new("RemoteEvent")
  11. Event.Name = "UserInput_Event"
  12.  
  13. --Fake event to make stuff like Mouse.KeyDown work
  14. local function fakeEvent()
  15. local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  16. t.connect = t.Connect
  17. return t
  18. end
  19.  
  20. --Creating fake input objects with fake variables
  21. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  22. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  23. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  24. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  25. end}
  26. --Merged 2 functions into one by checking amount of arguments
  27. CAS.UnbindAction = CAS.BindAction
  28.  
  29. --This function will trigger the events that have been :Connect()'ed
  30. local function te(self,ev,...)
  31. local t = m[ev]
  32. if t and t._fakeEvent then
  33. for _,f in pairs(t.Functions) do
  34. f(...)
  35. end
  36. end
  37. end
  38. m.TrigEvent = te
  39. UIS.TrigEvent = te
  40.  
  41. Event.OnServerEvent:Connect(function(plr,io)
  42. if plr~=rp then return end
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. if not io.isMouse then
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  51. return m:TrigEvent(b and "Button2Down" or "Button2Up")
  52. end
  53. for _,t in pairs(CAS.Actions) do
  54. for _,k in pairs(t.Keys) do
  55. if k==io.KeyCode then
  56. t.Function(t.Name,io.UserInputState,io)
  57. end
  58. end
  59. end
  60. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  61. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  62. end
  63. end)
  64. Event.Parent = NLS([==[
  65. local Player = game:GetService("Players").LocalPlayer
  66. local Event = script:WaitForChild("UserInput_Event")
  67. local Mouse = Player:GetMouse()
  68. local UIS = game:GetService("UserInputService")
  69. local input = function(io,a)
  70. if a then return end
  71. --Since InputObject is a client-side instance, we create and pass table instead
  72. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  73. end
  74. UIS.InputBegan:Connect(input)
  75. UIS.InputEnded:Connect(input)
  76. local h,t
  77. --Give the server mouse data 30 times every second, but only if the values changed
  78. --If player is not moving their mouse, client won't fire events
  79. while wait(1/30) do
  80. if h~=Mouse.Hit or t~=Mouse.Target then
  81. h,t=Mouse.Hit,Mouse.Target
  82. Event:FireServer({isMouse=true,Target=t,Hit=h})
  83. end
  84. end]==],Player.Character)
  85.  
  86. ----Sandboxed game object that allows the usage of client-side methods and services
  87. --Real game object
  88. local _rg = game
  89.  
  90. --Metatable for fake service
  91. local fsmt = {
  92. __index = function(self,k)
  93. local s = rawget(self,"_RealService")
  94. if s then
  95. return typeof(s[k])=="function"
  96. and function(_,...)return s[k](s,...)end or s[k]
  97. end
  98. end,
  99. __newindex = function(self,k,v)
  100. local s = rawget(self,"_RealService")
  101. if s then s[k]=v end
  102. end
  103. }
  104. local function FakeService(t,RealService)
  105. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  106. return setmetatable(t,fsmt)
  107. end
  108.  
  109. --Fake game object
  110. local g = {
  111. GetService = function(self,s)
  112. return rawget(self,s) or _rg:GetService(s)
  113. end,
  114. Players = FakeService({
  115. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  116. },"Players"),
  117. UserInputService = FakeService(UIS,"UserInputService"),
  118. ContextActionService = FakeService(CAS,"ContextActionService"),
  119. RunService = FakeService({
  120. _btrs = {},
  121. RenderStepped = _rg:GetService("RunService").Heartbeat,
  122. BindToRenderStep = function(self,name,_,fun)
  123. self._btrs[name] = self.Heartbeat:Connect(fun)
  124. end,
  125. UnbindFromRenderStep = function(self,name)
  126. self._btrs[name]:Disconnect()
  127. end,
  128. },"RunService")
  129. }
  130. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  131. g.service = g.GetService
  132. FakeService(g,game)
  133. --Changing owner to fake player object to support owner:GetMouse()
  134. game,owner = g,g.Players.LocalPlayer
  135. end
  136. --By SincereProdeadZ
  137. mouse = game.Players.LocalPlayer:GetMouse()
  138. using = false
  139. ragdolling = false
  140. hit = Instance.new("Sound", game.Players.LocalPlayer.Character.Torso)
  141. hit.SoundId = "rbxassetid://1542642349"
  142. hit.Volume = 2
  143. hit1 = Instance.new("Sound", game.Players.LocalPlayer.Character.Torso)
  144. hit1.SoundId = "rbxassetid://1542642349"
  145. hit1.Volume = 2
  146. hit2 = Instance.new("Sound", game.Players.LocalPlayer.Character.Torso)
  147. hit2.SoundId = "rbxassetid://1542642349"
  148. hit2.Volume = 2
  149. hit3 = Instance.new("Sound", game.Players.LocalPlayer.Character.Torso)
  150. hit3.SoundId = "rbxassetid://1542642349"
  151. hit3.Volume = 2
  152. hit3.TimePosition = 0.33
  153.  
  154. stand = Instance.new("Sound", game.Players.LocalPlayer.Character.Torso)
  155. stand.SoundId = "rbxassetid://162456532"
  156. stand.Volume = 3
  157.  
  158. print("Press R to ragdollify")
  159. function respawn(key)
  160. key = key:lower()
  161. if key == "t" then
  162. stand:Play()
  163. if ragdolling then
  164. ragdolling = false
  165. lshclone.Parent = game.Players.LocalPlayer.Character.Torso
  166. glue:destroy()
  167. rshclone.Parent = game.Players.LocalPlayer.Character.Torso
  168. glue1:destroy()
  169. lhclone.Parent = game.Players.LocalPlayer.Character.Torso
  170. glue11:destroy()
  171. rhclone.Parent = game.Players.LocalPlayer.Character.Torso
  172. glue111:destroy()
  173. collider:destroy()
  174. collider1:destroy()
  175. collider11:destroy()
  176. collider111:destroy()
  177. sensoring:destroy()
  178. sensoring1:destroy()
  179. game.Players.LocalPlayer.Character.Torso.SpotLight:destroy()
  180. game.Players.LocalPlayer.Character.Humanoid.PlatformStand = false
  181. end
  182. end
  183. end
  184. mouse.KeyDown:connect(respawn)
  185. function ragdoll(key)
  186. key = key:lower()
  187. if key == "r" then
  188. if not ragdolling then
  189. ragdolling = true
  190. local light = Instance.new("SpotLight", game.Players.LocalPlayer.Character.Torso)
  191. game.Players.LocalPlayer.Character.Humanoid.PlatformStand = true
  192. lshclone = game.Players.LocalPlayer.Character.Torso["Left Shoulder"]:Clone()
  193. rshclone = game.Players.LocalPlayer.Character.Torso["Right Shoulder"]:Clone()
  194. lhclone = game.Players.LocalPlayer.Character.Torso["Left Hip"]:Clone()
  195. rhclone = game.Players.LocalPlayer.Character.Torso["Right Hip"]:Clone()
  196. local leftarm = game.Players.LocalPlayer.Character["Left Arm"]
  197. local rightrm = game.Players.LocalPlayer.Character["Right Arm"]
  198. local leftleg = game.Players.LocalPlayer.Character["Left Leg"]
  199. local rightleg = game.Players.LocalPlayer.Character["Right Leg"]
  200. game.Players.LocalPlayer.Character.Torso["Left Hip"]:destroy()
  201. local head = game.Players.LocalPlayer.Character.Head
  202. glue = Instance.new("Glue", game.Players.LocalPlayer.Character.Torso)
  203. glue.Part0 = game.Players.LocalPlayer.Character.Torso
  204. glue.Part1 = leftleg
  205. glue.Name = "Left leg"
  206. collider = Instance.new("Part", leftleg)
  207. collider.Position = Vector3.new(0,999,0)
  208. collider.Size = Vector3.new(1.5, 1, 1)
  209. collider.Shape = "Cylinder"
  210. local weld = Instance.new("Weld", collider)
  211. weld.Part0 = leftleg
  212. weld.Part1 = collider
  213. weld.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
  214. collider.TopSurface = "Smooth"
  215. collider.BottomSurface = "Smooth"
  216. collider.formFactor = "Symmetric"
  217. glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  218. glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  219. collider.Transparency = 1
  220. ------------
  221. game.Players.LocalPlayer.Character.Torso["Right Hip"]:destroy()
  222. glue1 = Instance.new("Glue", game.Players.LocalPlayer.Character.Torso)
  223. glue1.Part0 = game.Players.LocalPlayer.Character.Torso
  224. glue1.Part1 = rightleg
  225. glue1.Name = "Right leg"
  226. collider1 = Instance.new("Part", rightleg)
  227. collider1.Position = Vector3.new(0,9999,0)
  228. collider1.Size = Vector3.new(1.5, 1, 1)
  229. collider1.Shape = "Cylinder"
  230. local weld1 = Instance.new("Weld", collider1)
  231. weld1.Part0 = rightleg
  232. weld1.Part1 = collider1
  233. weld1.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
  234. collider1.TopSurface = "Smooth"
  235. collider1.BottomSurface = "Smooth"
  236. collider1.formFactor = "Symmetric"
  237. glue1.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  238. glue1.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  239. collider1.Transparency = 1
  240. ------------
  241. game.Players.LocalPlayer.Character.Torso["Right Shoulder"]:destroy()
  242. glue11 = Instance.new("Glue", game.Players.LocalPlayer.Character.Torso)
  243. glue11.Part0 = game.Players.LocalPlayer.Character.Torso
  244. glue11.Part1 = rightrm
  245. glue11.Name = "Right shoulder"
  246. collider11 = Instance.new("Part", rightrm)
  247. collider11.Position = Vector3.new(0,9999,0)
  248. collider11.Size = Vector3.new(1.8,1,1)
  249. collider11.Shape = "Cylinder"
  250. local weld11 = Instance.new("Weld", collider11)
  251. weld11.Part0 = rightrm
  252. weld11.Part1 = collider11
  253. weld11.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
  254. collider11.TopSurface = "Smooth"
  255. collider11.BottomSurface = "Smooth"
  256. collider11.formFactor = "Symmetric"
  257. glue11.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  258. glue11.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  259. collider11.Transparency = 1
  260. ------------
  261. game.Players.LocalPlayer.Character.Torso["Left Shoulder"]:destroy()
  262. glue111 = Instance.new("Glue", game.Players.LocalPlayer.Character.Torso)
  263. glue111.Part0 = game.Players.LocalPlayer.Character.Torso
  264. glue111.Part1 = leftarm
  265. glue111.Name = "Left shoulder"
  266. collider111 = Instance.new("Part", leftarm)
  267. collider111.Position = Vector3.new(0,9999,0)
  268. collider111.Size = Vector3.new(1.5, 1, 1)
  269. collider111.Shape = "Cylinder"
  270. local weld111 = Instance.new("Weld", collider111)
  271. weld111.Part0 = leftarm
  272. weld111.Part1 = collider111
  273. weld111.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
  274. collider111.TopSurface = "Smooth"
  275. collider111.BottomSurface = "Smooth"
  276. collider111.formFactor = "Symmetric"
  277. glue111.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  278. glue111.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  279. collider111.Transparency = 1
  280. -----------------
  281. sensoring = Instance.new("Part", game.Players.LocalPlayer.Character.Torso)
  282. sensoring.Size = Vector3.new(1.2,1.1,0.8)
  283. sensoring.CanCollide = false
  284. sensoring.Position = game.Players.LocalPlayer.Character.Torso.Position
  285. local welder = Instance.new("Weld", sensoring)
  286. welder.Part0 = game.Players.LocalPlayer.Character.Torso
  287. welder.Part1 = sensoring
  288. welder.C0 = welder.C0 * CFrame.new(0,0,1.05)
  289. sensoring.Transparency = 1
  290. -----------------
  291. sensoring1 = Instance.new("Part", game.Players.LocalPlayer.Character.Torso)
  292. sensoring1.Size = Vector3.new(1.2,1.1,0.8)
  293. sensoring1.CanCollide = false
  294. sensoring1.Position = game.Players.LocalPlayer.Character.Torso.Position
  295. local welder1 = Instance.new("Weld", sensoring)
  296. welder1.Part0 = game.Players.LocalPlayer.Character.Torso
  297. welder1.Part1 = sensoring1
  298. welder1.C0 = welder1.C0 * CFrame.new(0,0,-1.05)
  299. sensoring1.Transparency = 1
  300. local function touch()
  301. if not using then
  302. using = true
  303. local Math = math.random(1,4)
  304. if Math == 1 then
  305. hit:Play()
  306. end
  307. if Math == 2 then
  308. hit1:Play()
  309. end
  310. if Math == 3 then
  311. hit2:Play()
  312. end
  313. if Math == 4 then
  314. hit3:Play()
  315. end
  316. wait(0.1)
  317. using = false
  318. end
  319. end
  320. sensoring.Touched:connect(touch)
  321. sensoring1.Touched:connect(touch)
  322. end
  323.  
  324. end
  325. end
  326. mouse.KeyDown:connect(ragdoll)
  327. --di ent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement