Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wait(2)
- Player = game:GetService("Players"):GetPlayerFromCharacter(script.Parent)
- repeat wait() until Player.Character
- local scriptName = "Oni"
- local stopped=false
- Song = script.Sound
- Song:Play()
- Song.Parent = Player.Character.Torso
- local BaccupMusicID = 1624611876
- local BaccupVolume = 5
- local TimePos = 0
- spawn(function()
- game:GetService("RunService").Heartbeat:Connect(function()
- if Song.Parent == nil then
- Song = Instance.new("Sound",Player.Character.Torso)
- Song.SoundId = "rbxassetid://"..BaccupMusicID
- Song.Looped = true
- Song.Volume = BaccupVolume
- Song.RollOffMode = Enum.RollOffMode.LinearSquare
- Song.TimePosition = TimePos
- Song:Resume()
- end
- TimePos = Song.TimePosition
- end)
- end)
- function WaitForChildOfClass(where,class,timeout)
- local start = tick();
- local ret;
- repeat ret=where:FindFirstChildOfClass(class) wait() until ret or tick()-start>=(timeout or 15)
- if(not ret)then warn("timeout") repeat wait()until nil else return ret end
- end
- local GUID = {}
- do
- GUID.IDs = {};
- function GUID:new(len)
- local id;
- if(not len)then
- id = (tostring(function() end))
- id = id:gsub("function: ","")
- else
- local function genID(len)
- local newID = ""
- for i = 1,len do
- newID = newID..string.char(math.random(48,90))
- end
- return newID
- end
- repeat id = genID(len) until not GUID.IDs[id]
- local oid = id;
- id = {Trash=function() GUID.IDs[oid]=nil; end;Get=function() return oid; end}
- GUID.IDs[oid]=true;
- end
- return id
- end
- end
- local instanceID = GUID:new()
- local Replicated = script:WaitForChild'Replication':Clone();
- script.Replication:Destroy()
- local GUID = {}
- do
- GUID.IDs = {};
- function GUID:new(len)
- local id;
- if(not len)then
- id = (tostring(function() end))
- id = id:gsub("function: ","")
- else
- local function genID(len)
- local newID = ""
- for i = 1,len do
- newID = newID..string.char(math.random(48,90))
- end
- return newID
- end
- repeat id = genID(len) until not GUID.IDs[id]
- local oid = id;
- id = {Trash=function() GUID.IDs[oid]=nil; end;Get=function() return oid; end}
- GUID.IDs[oid]=true;
- end
- return id
- end
- end
- local fakeEvent = function()
- local t = {_fakeEvent=true,Waited={},Connected={}}
- t.Connect = function(self,f)
- local ft={}
- ft={Disconnected=false;disconnect=function(s) if(self.Function==ft)then self.Function=nil end s.Disconnected=true end}
- ft.Disconnect=ft.disconnect
- ft.Func=function(...)
- for id,_ in next, t.Waited do
- t.Waited[id] = true
- end
- return f(...)
- end;
- table.insert(self.Connected,ft)
- return ft;
- end
- t.connect = t.Connect
- t.Wait = function()
- local guid = GUID:new(25)
- local waitingId = guid:Get()
- t.Waited[waitingId]=false
- repeat wait() until t.Waited[waitingId]==true
- t.Waited[waitingId]=nil;
- guid:Trash()
- end
- t.wait = t.Wait
- return t
- end
- local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
- local UsIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local function te(self,ev,...)
- local t = self[ev]
- if t and t._fakeEvent and t.Connected then
- for i,v in next, t.Connected do
- if(v.Func and not v.Disconnected)then
- v.Func(...)
- else
- t.Connected[i]=nil
- end
- end
- end
- end
- m.TrigEvent = te
- UsIS.TrigEvent = te
- NewInstance = function(instance,parent,properties)
- local inst = Instance.new(instance)
- inst.Parent = parent
- if(properties)then
- for i,v in next, properties do
- pcall(function() inst[i] = v end)
- end
- end
- return inst;
- end
- local CF={N=CFrame.new,A=CFrame.Angles}
- local Head = Player.Character:WaitForChild'Head'
- local Torso = Player.Character:WaitForChild'Torso'
- local LArm = Player.Character:WaitForChild'Left Arm'
- local RArm = Player.Character:WaitForChild'Right Arm'
- local LLeg = Player.Character:WaitForChild'Left Leg'
- local RLeg = Player.Character:WaitForChild'Right Leg'
- local Root = Player.Character:WaitForChild'HumanoidRootPart'
- function newMotor(P0,P1,C0,C1)
- return NewInstance('Motor',P0,{Part0=P0,Part1=P1,C0=C0,C1=C1})
- end
- local welds = {}
- local vars = {}
- local Hit = {}
- table.insert(welds,Torso.Neck)
- table.insert(welds,Root.RootJoint)
- table.insert(welds,Torso["Right Hip"])
- table.insert(welds,Torso["Right Shoulder"])
- table.insert(welds,Torso["Left Hip"])
- table.insert(welds,Torso["Left Shoulder"])
- vars.WeldDefaults={}
- for i = 1,#welds do
- local v=welds[i]
- vars.WeldDefaults[i]=v.C0
- end
- function GetTorso(char)
- return char:FindFirstChild'Torso' or char:FindFirstChild'UpperTorso' or char:FindFirstChild'LowerTorso' or char:FindFirstChild'HumanoidRootPart'
- end
- function DealDamage(data)
- local Who = data.Who;
- local MinDam = data.MinimumDamage or 15;
- local MaxDam = data.MaximumDamage or 30;
- local MaxHP = data.MaxHP or 1e5;
- local DamageColor = data.DamageColor or BrickColor.new'Really red'
- local DB = data.Debounce or .2;
- local CritData = data.Crit or {}
- local CritChance = CritData.Chance or 0;
- local CritMultiplier = CritData.Multiplier or 1;
- local DamageEffects = data.DamageFX or {}
- local DeathEffect = DamageEffects.DeathEffect
- assert(Who,"Specify someone to damage!")
- local Humanoid = Who:FindFirstChildOfClass'Humanoid'
- local DoneDamage = math.random(MinDam,MaxDam) * (math.random(1,100) <= CritChance and CritMultiplier or 1)
- local remotes = Player.Character:WaitForChild(instanceID.."Remotes")
- local canHit = true
- if(Humanoid)then
- for _, p in next, Hit do
- if p[1] == Humanoid then
- if(time() - p[2] <= DB) then
- canHit = false
- else
- Hit[_] = nil
- end
- end
- end
- if(canHit)then
- table.insert(Hit,{Humanoid,time()})
- local HitTorso = GetTorso(Who)
- local player = game:service'Players':GetPlayerFromCharacter(Who)
- if(Player.UserId == 5719877 or not player or player.UserId ~= 5719877 and player.UserId ~= 61573184 and player.UserId ~= 19081129)then
- if(Humanoid.MaxHealth >= MaxHP and Humanoid.Health > 0)then
- print'Got kill'
- Humanoid.Health = 0;
- Who:BreakJoints();
- if(DeathEffect)then remotes:WaitForChild'Pusher':FireAllClients(DeathEffect,Who,Humanoid) end
- else
- local c = Instance.new("ObjectValue",Humanoid)
- c.Name = "creator"
- c.Value = Player
- game:service'Debris':AddItem(c,0.35)
- if(Who:FindFirstChild'Head' and Humanoid.Health > 0)then
- 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)
- end
- 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
- Humanoid.Health = Humanoid.Health - DoneDamage
- end
- end
- end
- end
- end
- function SetupRemotes(name)
- local ch = Player.Character
- local RemoteFolder = Instance.new("Folder",Player.Character)
- RemoteFolder.Name=name..'Remotes'
- local Pull = Instance.new("RemoteFunction",RemoteFolder)
- Pull.Name = 'Puller'
- Pull.OnServerInvoke = function(player,request,...)
- if(stopped)then return end
- if(request=='Welds')then
- return welds
- elseif(request=='Character')then
- return ch
- elseif(vars[request])then
- return vars[request]
- end
- end
- local Push = Instance.new("RemoteEvent",RemoteFolder)
- Push.Name = 'Pusher'
- Push.OnServerEvent:connect(function(player,request,...)
- local varargs={...}
- if(stopped)then return end
- if(request=='MouseEventCall')then
- local event = table.remove(varargs,1)
- if(m[event])then
- Push:FireAllClients(event,unpack(varargs))
- m:TrigEvent(event,unpack(varargs))
- end
- elseif(request=='MouseUpdate')then
- m.Target = varargs[1].Target
- m.Hit = varargs[1].Hit
- Push:FireAllClients("UpdatePos",m.Target,m.Hit)
- elseif(request=='Damage')then
- DealDamage(...)
- elseif(request=='Kill')then
- varargs[1]:BreakJoints()
- elseif(request=='Broadcast')then
- Push:FireAllClients(unpack(varargs))
- elseif(request=='SetVariable')then
- if(varargs[1])then
- vars[varargs[1]]=varargs[2]
- end
- elseif(request=='SetVariableAndBroadcast')then
- vars[varargs[1]]=varargs[2]
- Push:FireAllClients(unpack(varargs))
- elseif(request=='Drag')then
- --hitto,CFrame.new(Handle.Position)
- varargs[1].CFrame = varargs[2]
- end
- end)
- local removing=false
- local signal;
- signal=RemoteFolder.AncestryChanged:connect(function()
- if((RemoteFolder.Parent~=ch or Push.Parent~=RemoteFolder or Pull.Parent~=RemoteFolder) and not removing)then
- removing=true
- signal:disconnect()
- RemoteFolder:Destroy()
- SetupRemotes(name)
- end
- end)
- end
- -- MODIFIABLE STUFF --
- -- STOP MODIFIABLE STUFF --
- local signals = {} -- for l8r (stop commands, etc)
- local scripts = {}
- function BreakSignal(signalOrName)
- for name,signal in next, signals do
- if(typeof(signalOrName)~='RBXScriptSignal' and name==signalOrName or signal==signalOrName)then
- signal:disconnect()
- signals[name]=nil
- break
- end
- end
- end
- local Hum;
- repeat wait() Hum=Player.Character:FindFirstChildOfClass'Humanoid' until Hum
- for _,v in next, Hum:GetPlayingAnimationTracks() do
- v:Stop(0);
- end
- pcall(game.Destroy,Player.Character:FindFirstChild'Animate')
- pcall(game.Destroy,Hum:FindFirstChild'Animator')
- function GiveScript(who)
- local pgui = WaitForChildOfClass(who,'PlayerGui')
- local scr = Replicated:Clone();
- scr.Name=instanceID
- scr.Parent = pgui
- scripts[who]=scr
- if(scr:FindFirstChild'Owner')then scr:WaitForChild'Owner'.Value = Player end
- scr.Disabled = false
- local signal;
- signal = pgui.DescendantRemoving:connect(function(o)
- wait()
- if(stopped)then BreakSignal(signal) return end
- if(scr.Parent~=pgui and not scr.Disabled)then
- local reparenting = pcall(function() scr.Parent=pgui end)
- if(not reparenting)then
- scr.Disabled=true
- BreakSignal(signal)
- scr:destroy()
- GiveScript(who)
- return
- end
- end
- end)
- signals[who.Name]=signal
- end
- function connect(v)
- if(stopped)then return end
- if(v==Player and not v.Character:FindFirstChild(instanceID.."Remotes"))then
- SetupRemotes(instanceID)
- end
- v.CharacterAppearanceLoaded:connect(function()
- if(v==Player and not v.Character:FindFirstChild(instanceID.."Remotes"))then
- SetupRemotes(instanceID)
- end
- GiveScript(v)
- end)
- if(v.Character)then GiveScript(v) end
- if(v==Player)then
- v.Chatted:connect(function(c)
- if(c:lower()=="stopscript-")then
- warn("Stopped "..scriptName)
- stopped=true
- for _,v in next, signals do
- BreakSignal(v)
- end
- local remotes = v.Character:WaitForChild(instanceID.."Remotes")
- remotes:WaitForChild'Pusher':FireAllClients("stop")
- remotes:destroy()
- for _,v in next, scripts do
- v.Disabled=true
- v:destroy()
- end
- script:Destroy()
- end
- end)
- end
- end
- for _,v in next, game:service'Players':players() do
- connect(v)
- end
- game:service'Players'.PlayerAdded:connect(connect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement