JIT
simplifying animation code for better performance
this code. local data = require(script:WaitForChild'ClientReplication')(script,script:WaitForChild'Owner'.Value) local req = data.Requests local S = setmetatable({},{__index = function(s,i) return game:service(i) end}) local CF = {N=CFrame.new,A=CFrame.Angles,fEA=CFrame.fromEulerAnglesXYZ} local C3 = {tRGB= function(c3) return c3.r*255,c3.g*255,c3.b*255 end,N=Color3.new,RGB=Color3.fromRGB,HSV=Color3.fromHSV,tHSV=Color3.toHSV} local V3 = {N=Vector3.new,FNI=Vector3.FromNormalId,A=Vector3.FromAxis} local M = {C=math.cos,R=math.rad,S=math.sin,P=math.pi,RNG=math.random,MRS=math.randomseed,H=math.huge,RRNG = function(min,max,div) return math.rad(math.random(min,max)/(div or 1)) end} local R3 = {N=Region3.new} local De = S.Debris local WS = workspace local Lght = S.Lighting local RepS = S.ReplicatedStorage local IN = Instance.new local Plrs = S.Players local Player = data.User local Char = req:Pull"Character" local Mouse = data.Local:GetMouse(); local Hum = Char:FindFirstChildOfClass'Humanoid' local Torso = Char.Torso local RArm = Char["Right Arm"] local LArm = Char["Left Arm"] local RLeg = Char["Right Leg"] local LLeg = Char["Left Leg"] local Root = Char:FindFirstChild'HumanoidRootPart' local Head = Char.Head local Sine = 0; local Change = 1 local Attack=false local NeutralAnims=true local timePos=30; local walking=true; local legAnims=true; local movement = 8 local footsound=0; local WalkSpeed=16; local Combo=0; -- Timing / loop configuration local Frame_Speed = 60 local SWAIT_DELAY = 0.5 -- desired extra delay after each artificial heartbeat local DESIRED_FRAME_TIME = (1 / Frame_Speed) + SWAIT_DELAY -- ensure each swait call targets this total time function SetTween(SPart,CFr,MoveStyle2,outorin2,AnimTime) local MoveStyle = Enum.EasingStyle[MoveStyle2] local outorin = Enum.EasingDirection[outorin2] local dahspeed=1 if Attack == true then dahspeed=3 end if SPart.Name=="Bullet" then dahspeed=1 end local requestedDuration = (type(AnimTime) == "number") and AnimTime or 0.001 -- ensure tween duration is at least DESIRED_FRAME_TIME so consecutive SetTween calls interpolate smoothly local duration = math.max(requestedDuration / dahspeed, DESIRED_FRAME_TIME) local tweeningInformation = TweenInfo.new( duration, MoveStyle, outorin, 0, false, 0 ) local MoveCF = CFr local tweenanim = game:GetService("TweenService"):Create(SPart,tweeningInformation,MoveCF) tweenanim:Play() return tweenanim end 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 NK,RJ,RH,RS,LH,LS=unpack(req:Pull"Welds") local NKC0,RJC0,RHC0,RSC0,LHC0,LSC0=unpack(req:Pull"WeldDefaults") if(req.Recievers.sync)then req:DelReciever("sync") end if(req.Recievers.playMusic)then req:DelReciever("playMusic") end if(req.Recievers.effect)then req:DelReciever("effect") end if(req.Recievers.stop)then req:DelReciever("stop") end if(req.Recievers.ShowDamage)then req:DelReciever("ShowDamage") end function makeMusic(id,pit,timePos) local sound = Torso:FindFirstChild(script.Name.."song") if(not sound)then sound = NewInstance("Sound",Torso,{Name=script.Name.."song",Volume=5,Pitch=(pit or 1),Looped=true}) NewInstance("EqualizerSoundEffect",sound,{HighGain=0,MidGain=2,LowGain=30}) end if(id=='stop')then if(sound)then sound:Stop() end else local timePos = typeof(timePos)=='number' and timePos or sound.TimePosition sound.Volume = 5 sound.Name = script.Name.."song" sound.Looped=true sound.SoundId = "rbxassetid://"..id sound.Pitch=(pit or 1) sound:Play() sound.TimePosition = timePos end return sound; end req:AddReciever("playMusic",function(id,pitch,timePos) if(data.Local~=data.User)then makeMusic(id,pitch,timePos) end end) function playMusic(id,pitch,timePos) req:Push("Broadcast","playMusic",id,pitch,timePos) return makeMusic(id,pitch,timePos) end for _,v in next, Hum:GetPlayingAnimationTracks() do v:Stop(0); end local ArtificialHB = script:FindFirstChild'Heartbeat' or IN("BindableEvent", script) ArtificialHB.Name = "Heartbeat" local tf = 0 local allowframeloss = true local tossremainder = true local lastframe = tick() local frame = 1/Frame_Speed ArtificialHB:Fire() game:GetService("RunService").Stepped:connect(function(s, p) tf = tf + s if tf >= frame then if allowframeloss then ArtificialHB:Fire() lastframe = tick() else for i = 1, math.floor(tf / frame) do ArtificialHB:Fire() end lastframe = tick() end if tossremainder then tf = 0 else tf = tf - frame * math.floor(tf / frame) end end end) local _wait = (task and task.wait) or wait -- swait: wait for the artificial heartbeat then ensure the total time consumed by this call -- is approximately DESIRED_FRAME_TIME. This keeps a consistent delay (SWAIT_DELAY) -- while preventing the last frame of a looping animation from lingering longer. function swait(num) num = (num == nil) and 1 or num for i = 1, num do local t0 = tick() ArtificialHB.Event:wait() local dt = tick() - t0 local rem = DESIRED_FRAME_TIME - dt if rem > 0 then _wait(rem) end end end if(workspace:FindFirstChild(script.Name..'Effects'))then workspace[script.Name..'Effects']:destroy() end local Effects=NewInstance("Folder",Char) Effects.Name=script.Name..'Effects' function ShowDamage(Pos, Text, Time, Color) local Pos = Pos or V3.N(0, 0, 0) local Text = tostring(Text or "") local Time = Time or 2 local Color = Color or C3.N(1, 0, 1) local EffectPart = Part(Effects,Color,Enum.Material.SmoothPlastic,V3.N(.05,.05,.05),CFrame.new(Pos),true,false) EffectPart.Transparency=1 local BillboardGui = NewInstance("BillboardGui",EffectPart,{ Size = UDim2.new(3,0,3,0), Adornee = EffectPart, }) local TextLabel = NewInstance("TextLabel",BillboardGui,{ BackgroundTransparency = 1, Size = UDim2.new(1, 0, 1, 0), Text = Text, TextColor3 = Color, TextScaled = true, Font = Enum.Font.ArialBold, }) S.Debris:AddItem(EffectPart, Time+.5) delay(0, function() local rot=math.random(-10,10)/15 local raise=.2 local Frames = Time/Frame_Speed for i=0,1.1,.02 do swait() TextLabel.Rotation=TextLabel.Rotation+rot raise=raise-.008 EffectPart.Position = EffectPart.Position + Vector3.new(0, raise, 0) TextLabel.TextTransparency=i TextLabel.TextStrokeTransparency=i end if EffectPart and EffectPart.Parent then EffectPart:Destroy() end end) end req:AddReciever("ShowDamage",ShowDamage) local baseSound = IN("Sound") function Sound(parent,id,pitch,volume,looped,effect,autoPlay) local Sound = baseSound:Clone() Sound.SoundId = "rbxassetid://".. tostring(id or 0) Sound.Pitch = pitch or 1 Sound.Volume = volume or 1 Sound.Looped = looped or false if(autoPlay)then coroutine.wrap(function() repeat wait() until Sound.IsLoaded Sound.Playing = autoPlay or false end)() end if(not looped and effect)then Sound.Stopped:connect(function() Sound.Volume = 0 Sound:destroy() end) elseif(effect)then warn("Sound can't be looped and a sound effect!") end Sound.Parent =parent or Torso return Sound end function Part(parent,color,material,size,cframe,anchored,cancollide) local part = IN("Part") part.Parent = parent or Char part[typeof(color) == 'BrickColor' and 'BrickColor' or 'Color'] = color or C3.N(0,0,0) part.Material = material or Enum.Material.SmoothPlastic part.TopSurface,part.BottomSurface=10,10 part.Size = size or V3.N(1,1,1) part.CFrame = cframe or CF.N(0,0,0) part.CanCollide = cancollide or false part.Anchored = anchored or false return part end function Weld(part0,part1,c0,c1) local weld = IN("Weld") weld.Parent = part0 weld.Part0 = part0 weld.Part1 = part1 weld.C0 = c0 or CF.N() weld.C1 = c1 or CF.N() return weld end function Mesh(parent,meshtype,meshid,textid,scale,offset) local part = IN("SpecialMesh") part.MeshId = meshid or "" part.TextureId = textid or "" part.Scale = scale or V3.N(1,1,1) part.Offset = offset or V3.N(0,0,0) part.MeshType = meshtype or Enum.MeshType.Sphere part.Parent = parent return part end function GotEffect(data) local color = data.Color or Color3.new(.7,.7,.7); local endcolor = data.EndColor or nil; local mat = data.Material or Enum.Material.SmoothPlastic; local cframe = data.CFrame or CFrame.new(); local endpos = data.EndPos or nil; local meshdata = data.Mesh or {} local sounddata = data.Sound or {} local size = data.Size or Vector3.new(1,1,1) local endsize = data.EndSize or Vector3.new(6,6,6) local rotinc = data.RotInc or {0,0,0} local transparency = data.Transparency or NumberRange.new(0,1) local acceleration = data.Acceleration or nil; local endrot = data.EndRotation or {0,0,0} local style = data.Style or false; local lifetime = data.Lifetime or 1; local system = data.FXSystem; local S,PM; local P = Part(workspace,color,mat,Vector3.new(1,1,1),cframe,true,false) if(meshdata == "Blast")then PM = Mesh(P,Enum.MeshType.FileMesh,'rbxassetid://20329976','',size,Vector3.new(0,0,-size.X/8)) elseif(meshdata == 'Ring')then PM = Mesh(P,Enum.MeshType.FileMesh,'rbxassetid://559831844','',size,Vector3.new(0,0,0)) elseif(meshdata == 'Slash1')then PM = Mesh(P,Enum.MeshType.FileMesh,'rbxassetid://662586858','',Vector3.new(size.X/10,.001,size.Z/10),Vector3.new(0,0,0)) elseif(meshdata == 'Slash2')then PM = Mesh(P,Enum.MeshType.FileMesh,'rbxassetid://448386996','',Vector3.new(size.X/1000,size.Y/100,size.Z/100),Vector3.new(0,0,0)) elseif(meshdata == 'Tornado1')then PM = Mesh(P,Enum.MeshType.FileMesh,'rbxassetid://443529437','',size/10,Vector3.new(0,0,0)) elseif(meshdata == 'Tornado2')then PM = Mesh(P,Enum.MeshType.FileMesh,'rbxassetid://168892432','',size/4,Vector3.new(0,0,0)) elseif(meshdata == 'Skull')then PM = Mesh(P,Enum.MeshType.FileMesh,'rbxassetid://4770583','',size*2,Vector3.new(0,0,0)) elseif(meshdata == 'Crystal')then PM = Mesh(P,Enum.MeshType.FileMesh,'rbxassetid://9756362','',size,Vector3.new(0,0,0)) elseif(meshdata == 'Cloud')then PM = Mesh(P,Enum.MeshType.FileMesh,'rbxassetid://1095708','',size,Vector3.new(0,0,0)) elseif(typeof(meshdata) == 'table')then local Type = meshdata.Type or Enum.MeshType.Brick local ID = meshdata.ID or ''; local Tex = meshdata.Texture or ''; local Offset = meshdata.Offset or Vector3.new(0,0,0) PM = Mesh(P,Type,ID,Tex,size,Offset) else PM = Mesh(P,Enum.MeshType.Brick,'','',size) end local startTrans = typeof(transparency) == 'number' and transparency or typeof(transparency) == 'NumberRange' and transparency.Min or typeof(transparency) == 'table' and transparency[1] or 0 local endTrans = typeof(transparency) == 'NumberRange' and transparency.Max or typeof(transparency) == 'table' and transparency[2] or 1 P.Transparency = startTrans local random = Random.new(); game:service'Debris':AddItem(P,lifetime+3) local mult = 1; if(PM.MeshId == 'rbxassetid://20329976')then PM.Offset = Vector3.new(0,0,-PM.Scale.Z/8) elseif(PM.MeshId == 'rbxassetid://4770583')then mult = 2 elseif(PM.MeshId == 'rbxassetid://168892432')then mult = .25 elseif(PM.MeshId == 'rbxassetid://443529437')then mult = .1 elseif(PM.MeshId == 'rbxassetid://443529437')then mult = .1 end coroutine.wrap(function() if(system == 'Legacy' or system == 1 or system == nil)then local frames = (typeof(lifetime) == 'NumberRange' and random:NextNumber(lifetime.Min,lifetime.Max) or typeof(lifetime) == 'number' and lifetime or 1)*Frame_Speed for i = 0, frames do local div = (i/frames) P.Transparency=(startTrans+(endTrans-startTrans)*div) PM.Scale = size:lerp(endsize*mult,div) local RotCF=CFrame.Angles(0,0,0) if(rotinc == 'random')then RotCF=CFrame.Angles(math.rad(random:NextNumber(-180,180)),math.rad(random:NextNumber(-180,180)),math.rad(random:NextNumber(-180,180))) elseif(typeof(rotinc) == 'table')then RotCF=CFrame.Angles(unpack(rotinc)) end if(PM.MeshId == 'rbxassetid://20329976')then PM.Offset = Vector3.new(0,0,-PM.Scale.Z/8) end if(endpos and typeof(endpos) == 'CFrame')then P.CFrame=cframe:lerp(endpos,div)*RotCF elseif(acceleration and typeof(acceleration) == 'table' and acceleration.Force)then local force = acceleration.Force; if(typeof(force)=='CFrame')then force=force.p; end if(typeof(force)=='Vector3')then if(acceleration.LookAt)then P.CFrame=(CFrame.new(P.Position,force)+force)*RotCF else P.CFrame=(P.CFrame+force)*RotCF end end else P.CFrame=P.CFrame*RotCF end if(endcolor and typeof(endcolor) == 'Color3')then P.Color = color:lerp(endcolor,div) end swait() end P:destroy() elseif(system == 'Experimental' or system == 2)then local info = TweenInfo.new(lifetime,style,Enum.EasingDirection.InOut,0,false,0) local info2 = TweenInfo.new(lifetime,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0) if(style == Enum.EasingStyle.Elastic)then info = TweenInfo.new(lifetime*2,style,Enum.EasingDirection.Out,0,false,0) elseif(style == Enum.EasingStyle.Bounce)then info = TweenInfo.new(lifetime,style,Enum.EasingDirection.Out,0,false,0) end local tweenPart = game:service'TweenService':Create(P,info2,{ CFrame=(typeof(endpos) == 'CFrame' and endpos or P.CFrame)*CFrame.Angles(unpack(endrot)), Color=typeof(endcolor) == 'Color3' and endcolor or color, Transparency=endTrans, }) local off = Vector3.new(0,0,0) if(PM.MeshId == 'rbxassetid://20329976')then off=Vector3.new(0,0,(endsize*mult).Z/8) end local tweenMesh = game:service'TweenService':Create(PM,info,{ Scale=endsize*mult, Offset=off, }) tweenPart:Play() tweenMesh:Play() end end)() end function Effect(data) if(data.User==data.Local)then req:Push("Broadcast","effect",data) GotEffect(data) end end req:AddReciever("effect",function(data) if(data.User~=data.Local)then GotEffect(data) end end) function Trail(data) coroutine.wrap(function() data.Frames = typeof(data.Frames)=='number' and data.Frames or 60 data.CFrame = typeof(data.CFrame)=='CFrame' and data.CFrame or Root.CFrame local ep = typeof(data.EndPos)=='CFrame' and data.EndPos or data.CFrame*CFrame.new(0,5,0); data.EndPos=nil local trailPart = Part(Effects,BrickColor.new'White',Enum.Material.SmoothPlastic,V3.N(.05,.05,.05),data.CFrame,true,false) trailPart.Transparency=1 local start = data.CFrame for i = 1, data.Frames do trailPart.CFrame = start:lerp(ep,i/data.Frames) data.CFrame = trailPart.CFrame Effect(data) swait() end end)() end function ClientTrail(data) coroutine.wrap(function() data.Frames = typeof(data.Frames)=='number' and data.Frames or 60 data.CFrame = typeof(data.CFrame)=='CFrame' and data.CFrame or Root.CFrame local ep = typeof(data.EndPos)=='CFrame' and data.EndPos or data.CFrame*CFrame.new(0,5,0); data.EndPos=nil local trailPart = Part(Effects,BrickColor.new'White',Enum.Material.SmoothPlastic,V3.N(.05,.05,.05),data.CFrame,true,false) trailPart.Transparency=1 local start = data.CFrame for i = 1, data.Frames do trailPart.CFrame = start:lerp(ep,i/data.Frames) data.CFrame = trailPart.CFrame GotEffect(data) swait() end end)() end function syncStuff(data) local neut,legwelds,c0s,c1s,sine,mov,walk,inc=unpack(data) local head0,torso0,rleg0,rarm0,lleg0,larm0=unpack(c0s) local head1,torso1,rleg1,rarm1,lleg1,larm1=unpack(c1s) legAnims=legwelds NeutralAnims=neut if(not neut)then NK.C0=head0 RJ.C0=torso0 RH.C0=rleg0 RS.C0=rarm0 LH.C0=lleg0 LS.C0=larm0 NK.C1=head1 RJ.C1=torso1 RH.C1=rleg1 RS.C1=rarm1 LH.C1=lleg1 LS.C1=larm1 end movement=mov walking=walk Change=inc if(Sine-sine>.8 or Sine-sine<-.8)then Sine=sine end end if(req:Pull("sync"))then syncStuff(req:Pull("sync")) end req:AddReciever("sync",function(syncdata)if(data.User~=data.Local)then syncStuff(syncdata) end end) req:AddReciever("stop",function() script:destroy() script.Disabled=false error("done") end) function Intro() if IntroCheck == false then if data.Local == data.User then IntroCheckRemote:FireServer("Yes") end Attack = true NeutralAnims = false legAnims = false end end game:service'UserInputService'.InputBegan:connect(function(io,gpe) if(gpe or Attack or data.User~=data.Local)then return end if(io.KeyCode==Enum.KeyCode.LeftAlt)then walking = not walking WalkSpeed=(walking and 16 or 36) movement=(walking and 8 or 14) end end) local footstepSounds = { [Enum.Material.Grass]=510933218; [Enum.Material.Metal]=1263161138; [Enum.Material.CorrodedMetal]=1263161138; [Enum.Material.DiamondPlate]=1263161138; [Enum.Material.Wood]=2452053757; [Enum.Material.WoodPlanks]=2452053757; [Enum.Material.Sand]=134456884; [Enum.Material.Snow]=2452051182; } while true do swait() Sine=Sine+Change local hitfloor,posfloor = workspace:FindPartOnRayWithIgnoreList(Ray.new(Root.CFrame.p,((CFrame.new(Root.Position,Root.Position - Vector3.new(0,1,0))).lookVector).unit * (4)), {Effects,Char}) local Walking = (math.abs(Root.Velocity.x) > 1 or math.abs(Root.Velocity.z) > 1) local State = (Hum.PlatformStand and 'Paralyzed' or Hum.Sit and 'Sit' or not hitfloor and Root.Velocity.y < -1 and "Fall" or not hitfloor and Root.Velocity.y > 1 and "Jump" or hitfloor and Walking and "Walk" or hitfloor and "Idle") Hum.WalkSpeed = WalkSpeed local sidevec = math.clamp((Root.Velocity*Root.CFrame.rightVector).X+(Root.Velocity*Root.CFrame.rightVector).Z,-Hum.WalkSpeed,Hum.WalkSpeed) local forwardvec = math.clamp((Root.Velocity*Root.CFrame.lookVector).X+(Root.Velocity*Root.CFrame.lookVector).Z,-Hum.WalkSpeed,Hum.WalkSpeed) local sidevelocity = sidevec/Hum.WalkSpeed local forwardvelocity = forwardvec/Hum.WalkSpeed local lhit,lpos = workspace:FindPartOnRayWithIgnoreList(Ray.new(LLeg.CFrame.p,((CFrame.new(LLeg.Position,LLeg.Position - Vector3.new(0,1,0))).lookVector).unit * (2)), {Effects,Char}) local rhit,rpos = workspace:FindPartOnRayWithIgnoreList(Ray.new(RLeg.CFrame.p,((CFrame.new(RLeg.Position,RLeg.Position - Vector3.new(0,1,0))).lookVector).unit * (2)), {Effects,Char}) SetTween(RJ,{C0 = RJC0 * CF.N(-0.650614857673645,-0.41455164551734924,-0.05614577233791351,0.7432668209075928,0.6681113243103027,-0.03437662497162819,-0.6603600978851318,0.7244743704795837,-0.19764000177383423,-0.10714052617549896,0.1696002185344696,0.9796717166900635)},"Back","Out",0.001) SetTween(NK,{C0 = NKC0 * CF.N(0.002390665700659156,0.0011954158544540405,-0.0000749826431274414,0.9943301677703857,-0.10633677244186401,7.450580596923828e-09,0.10515499114990234,0.9832791686058044,-0.1486760675907135,0.015809740871191025,0.14783309400081635,0.9888859391212463)},"Back","Out",0.001) SetTween(LS,{C0 = LSC0 * CF.N(-0.13054883480072021,-0.00006961822509765625,-0.0009336471557617188,0.3680625557899475,0.23367160558700562,-0.8999596834182739,-0.24932736158370972,0.9572617411613464,0.1465808004140854,0.8957487940788269,0.17043370008468628,0.4105929136276245)},"Back","Out",0.001) SetTween(RS,{C0 = RSC0 * CF.N(0.45592838525772095,0.026889264583587646,-0.14086169004440308,-0.8165836334228516,-0.10692444443702698,0.567237377166748,0.2203747183084488,-0.966006338596344,0.13515447080135345,0.5335036516189575,0.23536981642246246,0.81238853931427)},"Back","Out",0.001) SetTween(LH,{C0 = LHC0 * CF.N(-0.16401100158691406,0.2348530888557434,0.13639003038406372,0.9392836093902588,0.053364455699920654,0.33896684646606445,-0.09224215894937515,0.990739643573761,0.09962998330593109,-0.3305113613605499,-0.12484781444072723,0.9355080723762512)},"Back","Out",0.001) SetTween(RH,{C0 = RHC0 * CF.N(0.09915895015001297,0.032881081104278564,0.00668761134147644,0.984106183052063,0.0711885392665863,-0.16268908977508545,-0.06909125298261642,0.9974384903907776,0.018520399928092957,0.1635909080505371,-0.006985582411289215,0.9865034222602844)},"Back","Out",0.001) swait() SetTween(RJ,{C0 = RJC0 * CF.N(0,-0.6632230281829834,-0.15996895730495453,1,0,0,0,0.9724659323692322,-0.23304487764835358,0,0.23304487764835358,0.9724659323692322)},"Back","Out",0.001) SetTween(NK,{C0 = NKC0 * CF.N(0,-0.059746742248535156,-0.022235125303268433,1,0,0,0,0.937201201915741,-0.3487893342971802,0,0.3487893342971802,0.937201201915741)},"Back","Out",0.001) SetTween(LS,{C0 = LSC0 * CF.N(-0.5107297897338867,0.053823426365852356,0.5339252948760986,0.288625568151474,0,0.957442045211792,-0.9573427438735962,-0.01440739631652832,0.28859567642211914,0.013794247061014175,-0.9998962879180908,-0.004158343188464642)},"Back","Out",0.001) SetTween(RS,{C0 = RSC0 * CF.N(0.5740207433700562,-0.11009965091943741,0.47235989570617676,0.3798903226852417,-0.0426817312836647,-0.9240462779998779,0.9247229695320129,0.043322205543518066,0.37816745042800903,0.02389087900519371,-0.9981489777565002,0.05592646449804306)},"Back","Out",0.001) SetTween(LH,{C0 = LHC0 * CF.N(0.2522463798522949,-0.08732527494430542,-0.01593780517578125,0.9339451789855957,-0.356749027967453,-0.021830594167113304,0.3524976968765259,0.929470956325531,-0.10876169055700302,0.05909152328968048,0.09388221800327301,0.9938281178474426)},"Back","Out",0.001) SetTween(RH,{C0 = RHC0 * CF.N(-0.024863064289093018,-0.09448039531707764,-0.04200810194015503,0.8967447280883789,-0.43983957171440125,-0.04888487607240677,0.42850279808044434,0.8905795216560364,-0.1524898111820221,0.11060694605112076,0.11579716950654984,0.987095296382904)},"Back","Out",0.001) swait() SetTween(RJ,{C0 = RJC0 * CF.N(0.128361314535141,-0.21015684306621552,0.03714155778288841,0.8648533225059509,-0.4871572256088257,-0.12127062678337097,0.5012532472610474,0.8245654702186584,0.26236793398857117,-0.02781885862350464,-0.28769710659980774,0.9573173522949219)},"Back","Out",0.001) SetTween(NK,{C0 = NKC0 * CF.N(0,-1.4901161193847656e-07,3.2782554626464844e-07,1,0,0,0,0.852770209312439,-0.5222863554954529,0,0.5222863554529,0.852770209312439)},"Back","Out",0.001) SetTween(LS,{C0 = LSC0 * CF.N(-0.12647241353988647,-1.2223258018493652,-0.12809327244758606,-0.813661515712738,0.43180346488952637,-0.3892308175563812,-0.5467076301574707,-0.7960023880004883,0.2597901225090027,-0.19765040278434753,0.4241766333580017,0.883746862411499)},"Back","Out",0.001) SetTween(RS,{C0 = RSC0 * CF.N(0.1264362335205078,-1.2223217487335205,0.12810394167900085,-0.8171124458312988,-0.43920964002609253,0.37339261174201965,0.5444042687705,-0.8009456396102905,0.24921905994415283,0.18960785865783691,0.40691643953323364,0.8935701847076416)},"Back","Out",0.001) SetTween(LH,{C0 = LHC0 * CF.N(-0.12884032726287842,-0.05833035707473755,-0.0004950463771820068,0.9177454710006714,-0.39705416560173035,-0.009553402662277222,0.397113561630249,0.9169498682022095,0.038778893649578094,-0.006637305021286011,-0.0393829308450222,0.9992020726203918)},"Back","Out",0.001) SetTween(RH,{C0 = RHC0 * CF.N(0.10318832099437714,-0.1464276909828186,0.03080850839614868,0.9106330871582031,0.3643592894077301,-0.1949097365140915,-0.3537108898162842,0.9311891794204712,0.08817727863788605,0.21362604200839996,-0.011355450376868248,0.9768494963645935)},"Back","Out",0.001) swait() SetTween(RJ,{C0 = RJC0 * CF.N(0,-0.6632230281829834,-0.15996895730495453,1,0,0,0,0.9724659323692322,-0.23304487764835358,0,0.23304487764835358,0.9724659323692322)},"Back","Out",0.001) SetTween(NK,{C0 = NKC0 * CF.N(0,-0.059746742248535156,-0.022235125303268433,1,0,0,0,0.937201201915741,-0.3487893342971802,0,0.3487893342971802,0.937201201915741)},"Back","Out",0.001) SetTween(LS,{C0 = LSC0 * CF.N(-0.5107297897338867,0.053823426365852356,0.5339252948760986,0.288625568151474,0,0.957442045211792,-0.9573427438735962,-0.01440739631652832,0.28859567642211914,0.013794247061014175,-0.9998962879180908,-0.004158343188464642)},"Back","Out",0.001) SetTween(RS,{C0 = RSC0 * CF.N(0.5740207433700562,-0.11009965091943741,0.47235989570617676,0.3798903226852417,-0.0426817312836647,-0.9240462779998779,0.9247229695320129,0.043322205543518066,0.37816745042800903,0.02389087900519371,-0.9981489777565002,0.05592646449804306)},"Back","Out",0.001) SetTween(LH,{C0 = LHC0 * CF.N(0.2522463798522949,-0.08732527494430542,-0.01593780517578125,0.9339451789855957,-0.356749027967453,-0.021830594167113304,0.3524976968765259,0.929470956325531,-0.10876169055700302,0.05909152328968048,0.09388221800327301,0.9938281178474426)},"Back","Out",0.001) SetTween(RH,{C0 = RHC0 * CF.N(-0.024863064289093018,-0.09448039531707764,-0.04200810194015503,0.8967447280883789,-0.43983957171440125,-0.04888487607240677,0.42850279808044434,0.8905795216560364,-0.1524898111820221,0.11060694605112076,0.11579716950654984,0.987095296382904)},"Back","Out",0.001) swait() if(data.User==data.Local)then local syncStuff={ NeutralAnims; legAnims; {NK.C0,RJ.C0,RH.C0,RS.C0,LH.C0,LS.C0}; {NK.C1,RJ.C1,RH.C1,RS.C1,LH.C1,LS.C1}; Sine; movement; walking; Change } req:Push("SetVariableAndBroadcast","sync",syncStuff) end end make it that it just does the animation and nothing else.
Updated files
v1
do the same to this code. wait(0.25) 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 = 2372056506 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)
Updated files
v2