Advertisement
cat568

Untitled

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