cat568

Untitled

Dec 26th, 2018
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.09 KB | None | 0 0
  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.  
  148.  
  149. Services = setmetatable({},{__index=function(s,r) return game:service(r) end})
  150. Player = Services.Players.LocalPlayer
  151. wait()script.Parent=nil
  152. BodyParts={}
  153. abs = function(int)
  154. if int < 0 then return -int else return int end
  155. end
  156. rad = function(deg)
  157. return deg * math.pi / 180
  158. end
  159. deg = function(rad)
  160. return rad * 180 / math.pi
  161. end
  162. dist = function(p1,p2)
  163. r,e = ypcall(function()
  164. p1 = p1.Position
  165. end)
  166. if not r then p1 = p1 end
  167. r,e = ypcall(function()
  168. p2 = p2.Position
  169. end)
  170. if not r then p1 = p1 end
  171. return math.sqrt( (p2.X-p1.X)^2 + (p2.Y-p1.Y)^2 + (p2.Z-p1.Z)^2 )
  172. end
  173.  
  174. function GetChar()
  175. return Player.Character
  176. end
  177. function GetHum()
  178. for i,v in pairs(GetChar():children'') do
  179. if v.ClassName == 'Humanoid' then
  180. return v
  181. end
  182. end
  183. end
  184.  
  185. function Died()
  186. for i,v in pairs(GetChar():children'') do
  187. if v.ClassName == 'Part' then
  188. table.insert(BodyParts,{v.CFrame,v})
  189. elseif v.ClassName == 'Hat' then
  190. v.Parent=workspace
  191. table.insert(BodyParts,{v.Handle.CFrame,v.Handle,1})
  192. end
  193. end
  194.  
  195. wait(3)
  196. for i,v in pairs(BodyParts) do
  197. v[2].Anchored=true
  198. if v[2].Name == 'Torso' then pos = v[1] end
  199. end
  200.  
  201. for i,v in pairs(BodyParts) do
  202. coroutine.resume(coroutine.create(function()
  203. repeat Services.RunService.Heartbeat:wait()
  204. v[2].CFrame = v[2].CFrame:lerp(v[1],.1)
  205. until dist(v[2],v[1]) < .05
  206. v[2].CFrame=v[1]
  207. end))
  208. end
  209. end
  210.  
  211. Player.CharacterAdded:connect(function(char)
  212. char:WaitForChild('Torso')
  213. for i,v in pairs(BodyParts) do
  214. if v[3] then
  215. v[2]:Remove()
  216. end
  217. end
  218. BodyParts={}
  219. char.Torso.CFrame=pos or CFrame.new(0,12,0)
  220. GetHum().Died:connect(Died)
  221. end)
  222. GetHum().Died:connect(Died)
  223. print'rannering'
  224.  
  225. --[[
  226. Stand: The World
  227. User: DIO
  228. ]]
  229.  
  230. ---Declarations
  231. local Cn=CFrame.new
  232. local CA=CFrame.Angles
  233. local mr=math.rad
  234. local rn=math.random
  235. local mc=math.cos
  236. local Vn=Vector3.new
  237. local NR=NumberRange.new
  238. local NSeq=NumberSequence.new
  239. local plrs=game:service"Players"
  240. local wrk=game:service"Workspace"
  241. local deb=game:service"Debris"
  242. local IS=game:GetService("InsertService")
  243. local p=plrs.LocalPlayer
  244. local cam=wrk.CurrentCamera
  245. local char=p.Character
  246. local mouse=p:GetMouse()
  247. local lam=char["Left Arm"]
  248. local ram=char["Right Arm"]
  249. local llg=char["Left Leg"]
  250. local rlg=char["Right Leg"]
  251. local hed=char.Head
  252. local tor=char.Torso
  253. local larm = lam
  254. local rarm = ram
  255. local lleg = llg
  256. local rleg = rlg
  257. local torso = tor
  258. local hrp=char.HumanoidRootPart
  259. local PlayerSpeed = char.Humanoid.WalkSpeed
  260. local on=false
  261. local noRig=false
  262. local curws=16
  263. local sine=0
  264. local ift={}
  265. local ifxd=false
  266. local run=false
  267. local stance="Cane"
  268. local Speed = 16
  269. local Health = 9000
  270.  
  271. PlayerSpeed = 16
Advertisement
Add Comment
Please, Sign In to add comment