Advertisement
whyumean

Smug Hello, World

Jan 23rd, 2020
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.33 KB | None | 0 0
  1. wait(2)
  2. Player = game:GetService("Players"):GetPlayerFromCharacter(script.Parent)
  3. repeat wait() until Player.Character
  4. local scriptName = "Oni"
  5. local stopped=false
  6.  
  7. Song = script.Sound
  8. Song:Play()
  9. Song.Parent = Player.Character.Torso
  10.  
  11. local BaccupMusicID = 1624611876
  12. local BaccupVolume = 5
  13.  
  14. local TimePos = 0
  15.  
  16. spawn(function()
  17. game:GetService("RunService").Heartbeat:Connect(function()
  18. if Song.Parent == nil then
  19. Song = Instance.new("Sound",Player.Character.Torso)
  20. Song.SoundId = "rbxassetid://"..BaccupMusicID
  21. Song.Looped = true
  22. Song.Volume = BaccupVolume
  23. Song.RollOffMode = Enum.RollOffMode.LinearSquare
  24. Song.TimePosition = TimePos
  25. Song:Resume()
  26. end
  27. TimePos = Song.TimePosition
  28. end)
  29. end)
  30.  
  31. function WaitForChildOfClass(where,class,timeout)
  32. local start = tick();
  33. local ret;
  34. repeat ret=where:FindFirstChildOfClass(class) wait() until ret or tick()-start>=(timeout or 15)
  35. if(not ret)then warn("timeout") repeat wait()until nil else return ret end
  36. end
  37.  
  38. local GUID = {}
  39. do
  40. GUID.IDs = {};
  41. function GUID:new(len)
  42. local id;
  43. if(not len)then
  44. id = (tostring(function() end))
  45. id = id:gsub("function: ","")
  46. else
  47. local function genID(len)
  48. local newID = ""
  49. for i = 1,len do
  50. newID = newID..string.char(math.random(48,90))
  51. end
  52. return newID
  53. end
  54. repeat id = genID(len) until not GUID.IDs[id]
  55. local oid = id;
  56. id = {Trash=function() GUID.IDs[oid]=nil; end;Get=function() return oid; end}
  57. GUID.IDs[oid]=true;
  58. end
  59. return id
  60. end
  61. end
  62.  
  63. local instanceID = GUID:new()
  64.  
  65. local Replicated = script:WaitForChild'Replication':Clone();
  66. script.Replication:Destroy()
  67. local GUID = {}
  68. do
  69. GUID.IDs = {};
  70. function GUID:new(len)
  71. local id;
  72. if(not len)then
  73. id = (tostring(function() end))
  74. id = id:gsub("function: ","")
  75. else
  76. local function genID(len)
  77. local newID = ""
  78. for i = 1,len do
  79. newID = newID..string.char(math.random(48,90))
  80. end
  81. return newID
  82. end
  83. repeat id = genID(len) until not GUID.IDs[id]
  84. local oid = id;
  85. id = {Trash=function() GUID.IDs[oid]=nil; end;Get=function() return oid; end}
  86. GUID.IDs[oid]=true;
  87. end
  88. return id
  89. end
  90. end
  91.  
  92.  
  93. local fakeEvent = function()
  94. local t = {_fakeEvent=true,Waited={},Connected={}}
  95. t.Connect = function(self,f)
  96. local ft={}
  97. ft={Disconnected=false;disconnect=function(s) if(self.Function==ft)then self.Function=nil end s.Disconnected=true end}
  98. ft.Disconnect=ft.disconnect
  99.  
  100. ft.Func=function(...)
  101. for id,_ in next, t.Waited do
  102. t.Waited[id] = true
  103. end
  104. return f(...)
  105. end;
  106.  
  107. table.insert(self.Connected,ft)
  108. return ft;
  109. end
  110. t.connect = t.Connect
  111. t.Wait = function()
  112. local guid = GUID:new(25)
  113. local waitingId = guid:Get()
  114. t.Waited[waitingId]=false
  115. repeat wait() until t.Waited[waitingId]==true
  116. t.Waited[waitingId]=nil;
  117. guid:Trash()
  118. end
  119. t.wait = t.Wait
  120. return t
  121. end
  122.  
  123. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  124. local UsIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  125. local function te(self,ev,...)
  126. local t = self[ev]
  127. if t and t._fakeEvent and t.Connected then
  128. for i,v in next, t.Connected do
  129. if(v.Func and not v.Disconnected)then
  130. v.Func(...)
  131. else
  132. t.Connected[i]=nil
  133. end
  134. end
  135. end
  136. end
  137. m.TrigEvent = te
  138. UsIS.TrigEvent = te
  139.  
  140. NewInstance = function(instance,parent,properties)
  141. local inst = Instance.new(instance)
  142. inst.Parent = parent
  143. if(properties)then
  144. for i,v in next, properties do
  145. pcall(function() inst[i] = v end)
  146. end
  147. end
  148. return inst;
  149. end
  150.  
  151. local CF={N=CFrame.new,A=CFrame.Angles}
  152.  
  153. local Head = Player.Character:WaitForChild'Head'
  154. local Torso = Player.Character:WaitForChild'Torso'
  155. local LArm = Player.Character:WaitForChild'Left Arm'
  156. local RArm = Player.Character:WaitForChild'Right Arm'
  157. local LLeg = Player.Character:WaitForChild'Left Leg'
  158. local RLeg = Player.Character:WaitForChild'Right Leg'
  159. local Root = Player.Character:WaitForChild'HumanoidRootPart'
  160.  
  161. function newMotor(P0,P1,C0,C1)
  162. return NewInstance('Motor',P0,{Part0=P0,Part1=P1,C0=C0,C1=C1})
  163. end
  164.  
  165. local welds = {}
  166. local vars = {}
  167. local Hit = {}
  168.  
  169.  
  170.  
  171. table.insert(welds,Torso.Neck)
  172. table.insert(welds,Root.RootJoint)
  173. table.insert(welds,Torso["Right Hip"])
  174. table.insert(welds,Torso["Right Shoulder"])
  175. table.insert(welds,Torso["Left Hip"])
  176. table.insert(welds,Torso["Left Shoulder"])
  177.  
  178. vars.WeldDefaults={}
  179. for i = 1,#welds do
  180. local v=welds[i]
  181. vars.WeldDefaults[i]=v.C0
  182. end
  183.  
  184. function GetTorso(char)
  185. return char:FindFirstChild'Torso' or char:FindFirstChild'UpperTorso' or char:FindFirstChild'LowerTorso' or char:FindFirstChild'HumanoidRootPart'
  186. end
  187.  
  188.  
  189. function DealDamage(data)
  190. local Who = data.Who;
  191. local MinDam = data.MinimumDamage or 15;
  192. local MaxDam = data.MaximumDamage or 30;
  193. local MaxHP = data.MaxHP or 1e5;
  194. local DamageColor = data.DamageColor or BrickColor.new'Really red'
  195.  
  196. local DB = data.Debounce or .2;
  197.  
  198. local CritData = data.Crit or {}
  199. local CritChance = CritData.Chance or 0;
  200. local CritMultiplier = CritData.Multiplier or 1;
  201.  
  202. local DamageEffects = data.DamageFX or {}
  203. local DeathEffect = DamageEffects.DeathEffect
  204.  
  205. assert(Who,"Specify someone to damage!")
  206.  
  207. local Humanoid = Who:FindFirstChildOfClass'Humanoid'
  208. local DoneDamage = math.random(MinDam,MaxDam) * (math.random(1,100) <= CritChance and CritMultiplier or 1)
  209. local remotes = Player.Character:WaitForChild(instanceID.."Remotes")
  210.  
  211. local canHit = true
  212. if(Humanoid)then
  213. for _, p in next, Hit do
  214. if p[1] == Humanoid then
  215. if(time() - p[2] <= DB) then
  216. canHit = false
  217. else
  218. Hit[_] = nil
  219. end
  220. end
  221. end
  222. if(canHit)then
  223. table.insert(Hit,{Humanoid,time()})
  224. local HitTorso = GetTorso(Who)
  225. local player = game:service'Players':GetPlayerFromCharacter(Who)
  226. if(Player.UserId == 5719877 or not player or player.UserId ~= 5719877 and player.UserId ~= 61573184 and player.UserId ~= 19081129)then
  227. if(Humanoid.MaxHealth >= MaxHP and Humanoid.Health > 0)then
  228. print'Got kill'
  229. Humanoid.Health = 0;
  230. Who:BreakJoints();
  231. if(DeathEffect)then remotes:WaitForChild'Pusher':FireAllClients(DeathEffect,Who,Humanoid) end
  232.  
  233. else
  234. local c = Instance.new("ObjectValue",Humanoid)
  235. c.Name = "creator"
  236. c.Value = Player
  237. game:service'Debris':AddItem(c,0.35)
  238. if(Who:FindFirstChild'Head' and Humanoid.Health > 0)then
  239. remotes:WaitForChild'Pusher':FireAllClients('ShowDamage',(Who.Head.CFrame * CF.N(0, 0, (Who.Head.Size.Z / 2)).p+Vector3.new(0,1.5,0)+Vector3.new(math.random(-2,2),0,math.random(-2,2))),DoneDamage,1.5,DamageColor.Color)
  240. end
  241. if(Humanoid.Health > 0 and Humanoid.Health-DoneDamage <= 0)then print'Got kill' if(DeathEffect)then remotes:WaitForChild'Pusher':FireAllClients(DeathEffect,Who,Humanoid) end end
  242. Humanoid.Health = Humanoid.Health - DoneDamage
  243. end
  244. end
  245. end
  246. end
  247. end
  248.  
  249.  
  250. function SetupRemotes(name)
  251. local ch = Player.Character
  252. local RemoteFolder = Instance.new("Folder",Player.Character)
  253. RemoteFolder.Name=name..'Remotes'
  254. local Pull = Instance.new("RemoteFunction",RemoteFolder)
  255. Pull.Name = 'Puller'
  256. Pull.OnServerInvoke = function(player,request,...)
  257. if(stopped)then return end
  258. if(request=='Welds')then
  259. return welds
  260. elseif(request=='Character')then
  261. return ch
  262. elseif(vars[request])then
  263. return vars[request]
  264. end
  265. end
  266. local Push = Instance.new("RemoteEvent",RemoteFolder)
  267. Push.Name = 'Pusher'
  268. Push.OnServerEvent:connect(function(player,request,...)
  269. local varargs={...}
  270. if(stopped)then return end
  271. if(request=='MouseEventCall')then
  272. local event = table.remove(varargs,1)
  273. if(m[event])then
  274. Push:FireAllClients(event,unpack(varargs))
  275. m:TrigEvent(event,unpack(varargs))
  276. end
  277. elseif(request=='MouseUpdate')then
  278. m.Target = varargs[1].Target
  279. m.Hit = varargs[1].Hit
  280. Push:FireAllClients("UpdatePos",m.Target,m.Hit)
  281. elseif(request=='Damage')then
  282. DealDamage(...)
  283. elseif(request=='Kill')then
  284. varargs[1]:BreakJoints()
  285. elseif(request=='Broadcast')then
  286. Push:FireAllClients(unpack(varargs))
  287. elseif(request=='SetVariable')then
  288. if(varargs[1])then
  289. vars[varargs[1]]=varargs[2]
  290. end
  291. elseif(request=='SetVariableAndBroadcast')then
  292. vars[varargs[1]]=varargs[2]
  293. Push:FireAllClients(unpack(varargs))
  294. elseif(request=='Drag')then
  295. --hitto,CFrame.new(Handle.Position)
  296. varargs[1].CFrame = varargs[2]
  297. end
  298. end)
  299.  
  300. local removing=false
  301. local signal;
  302. signal=RemoteFolder.AncestryChanged:connect(function()
  303. if((RemoteFolder.Parent~=ch or Push.Parent~=RemoteFolder or Pull.Parent~=RemoteFolder) and not removing)then
  304. removing=true
  305. signal:disconnect()
  306. RemoteFolder:Destroy()
  307. SetupRemotes(name)
  308. end
  309. end)
  310. end
  311.  
  312. -- MODIFIABLE STUFF --
  313.  
  314.  
  315.  
  316. -- STOP MODIFIABLE STUFF --
  317. local signals = {} -- for l8r (stop commands, etc)
  318. local scripts = {}
  319.  
  320. function BreakSignal(signalOrName)
  321. for name,signal in next, signals do
  322. if(typeof(signalOrName)~='RBXScriptSignal' and name==signalOrName or signal==signalOrName)then
  323. signal:disconnect()
  324. signals[name]=nil
  325. break
  326. end
  327. end
  328. end
  329. local Hum;
  330. repeat wait() Hum=Player.Character:FindFirstChildOfClass'Humanoid' until Hum
  331. for _,v in next, Hum:GetPlayingAnimationTracks() do
  332. v:Stop(0);
  333. end
  334.  
  335. pcall(game.Destroy,Player.Character:FindFirstChild'Animate')
  336. pcall(game.Destroy,Hum:FindFirstChild'Animator')
  337.  
  338. function GiveScript(who)
  339. local pgui = WaitForChildOfClass(who,'PlayerGui')
  340. local scr = Replicated:Clone();
  341. scr.Name=instanceID
  342. scr.Parent = pgui
  343. scripts[who]=scr
  344. if(scr:FindFirstChild'Owner')then scr:WaitForChild'Owner'.Value = Player end
  345. scr.Disabled = false
  346. local signal;
  347. signal = pgui.DescendantRemoving:connect(function(o)
  348. wait()
  349. if(stopped)then BreakSignal(signal) return end
  350. if(scr.Parent~=pgui and not scr.Disabled)then
  351. local reparenting = pcall(function() scr.Parent=pgui end)
  352. if(not reparenting)then
  353. scr.Disabled=true
  354. BreakSignal(signal)
  355. scr:destroy()
  356. GiveScript(who)
  357. return
  358. end
  359. end
  360. end)
  361. signals[who.Name]=signal
  362. end
  363.  
  364. function connect(v)
  365. if(stopped)then return end
  366. if(v==Player and not v.Character:FindFirstChild(instanceID.."Remotes"))then
  367. SetupRemotes(instanceID)
  368. end
  369. v.CharacterAppearanceLoaded:connect(function()
  370. if(v==Player and not v.Character:FindFirstChild(instanceID.."Remotes"))then
  371. SetupRemotes(instanceID)
  372. end
  373. GiveScript(v)
  374. end)
  375. if(v.Character)then GiveScript(v) end
  376. if(v==Player)then
  377. v.Chatted:connect(function(c)
  378. if(c:lower()=="stopscript-")then
  379. warn("Stopped "..scriptName)
  380. stopped=true
  381. for _,v in next, signals do
  382. BreakSignal(v)
  383. end
  384. local remotes = v.Character:WaitForChild(instanceID.."Remotes")
  385. remotes:WaitForChild'Pusher':FireAllClients("stop")
  386. remotes:destroy()
  387. for _,v in next, scripts do
  388. v.Disabled=true
  389. v:destroy()
  390. end
  391. script:Destroy()
  392. end
  393. end)
  394. end
  395. end
  396.  
  397. for _,v in next, game:service'Players':players() do
  398. connect(v)
  399. end
  400.  
  401. game:service'Players'.PlayerAdded:connect(connect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement