Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script.Parent=owner.PlayerGui
- local Client=NLS([==[
- local math=setmetatable({random=function(Arg1,Arg2,DIV) DIV=DIV or 1 return math.random(Arg1*DIV,Arg2*DIV)/DIV end,CosSin=function(Arg) return (math.sin(Arg/2)*math.cos(Arg/2)) end,},{__index=math,})
- local CFrame=setmetatable({Angles=function(Arg1,Arg2,Arg3,Angles) if not Angles then return CFrame.Angles(Arg1,Arg2,Arg3) else return CFrame.Angles(math.rad(Arg1),math.rad(Arg2),math.rad(Arg3)) end end,},{__index=CFrame,})
- local Instance=setmetatable({new=function(type,args) local instance=Instance.new(type) if args then if string.lower(typeof(args)) == "instance" then instance.Parent=args elseif string.lower(typeof(args))=="table" then for i,v in pairs(args) do pcall(function() instance[i]=v end) end end end return instance end,Remove=function(Instance_,Time) if string.lower(typeof(Instance_))=="instance" then game:GetService("Debris"):AddItem(Instance_,Time or 0) elseif string.lower(typeof(Instance_))=="table" then table.foreach(Instance_,function(_,v) game:GetService("Debris"):AddItem(v,Time or 0) end) end end},{__index=Instance,})
- local ray=Ray.new
- local Player,UIS,Mouse=game:GetService("Players").LocalPlayer,game:GetService("UserInputService")
- local Mouse=Player:GetMouse()
- local Rem=script:WaitForChild("Input")
- local InfoRef=Rem.InfoRef
- local Values=script
- local HeadFollow=(Values.HeadFollow or{Value=false}).Value
- local Resetted=false
- local Char=Player.Character
- local H=Char.Head
- local Hum=Char:FindFirstChildOfClass("Humanoid")
- local HRP=Char.HumanoidRootPart
- local Effects=Char:WaitForChild("Effects")
- local Rocks={}
- local CSFuncs={Events={},Functions={}}
- function Raycast(Origin,Direction,Blacklist,MaxDistance,IgnoreWater)
- local Par=RaycastParams.new() Par.FilterType=Enum.RaycastFilterType.Blacklist Par.FilterDescendantsInstances=Blacklist Par.IgnoreWater=IgnoreWater
- local Res=workspace:Raycast(Origin,Direction.Unit*MaxDistance,Par)
- if Res then
- return Res.Instance,Res.Position,Res.Normal,Res.Material
- else
- return nil,Vector3.new(),Vector3.new(),Enum.Material.Air
- end
- end
- function CreateCSFunc(Type,Name,Func)
- if CSFuncs[Type.."s"] then
- CSFuncs[Type.."s"][Name]=Func
- return Func
- end
- end
- function CSFire(self,AT,Name,...)
- if not self then return end
- if AT=="S" then
- return Rem:FireServer({},false,AT,Name,...)
- elseif AT=="R" then
- return InfoRef:InvokeServer(AT,Name,...)
- end
- end
- function CSTrig(self,Type,Name,...)
- if not self then return end
- if CSFuncs[Type.."s"] and CSFuncs[Type.."s"][Name] then
- return CSFuncs[Type.."s"][Name](...)
- end
- end
- CSFuncs.new=CreateCSFunc
- CSFuncs.Fire=CSFire
- CSFuncs.Trigger=CSTrig
- --// Free space for CrossServer functions \\
- local TurnToggled=false
- CSFuncs.new("Event","ToggleTTM",function(Bool)
- TurnToggled=Bool
- end)
- UIS.InputBegan:Connect(function(IO,L) Rem:FireServer({Mouse=false,UserInputState=IO.UserInputState,KeyCode=IO.KeyCode,UserInputType=IO.UserInputType},L) end)
- UIS.InputEnded:Connect(function(IO,L) Rem:FireServer({Mouse=false,UserInputState=IO.UserInputState,KeyCode=IO.KeyCode,UserInputType=IO.UserInputType},L) end)
- game:GetService("RunService").Heartbeat:Connect(function()
- HeadFollow=(Values.HeadFollow or{Value=false}).Value
- if HeadFollow then
- Resetted=false
- local CF=H.CFrame:ToObjectSpace(HRP.CFrame*CFrame.new(0,1.5,0))
- Hum.CameraOffset=Hum.CameraOffset:Lerp(-CF.Position,.125)
- elseif not HeadFollow and not Resetted then
- Resetted=true
- Hum.CameraOffset=Vector3.new
- end
- if TurnToggled then
- HRP.CFrame=CFrame.new(HRP.Position,Vector3.new(Mouse.Hit.X,HRP.Position.Y,Mouse.Hit.Z))
- end
- if #Rocks>0 then
- for i,v in pairs(Rocks) do
- if not v[1].Parent then Rocks[i]=nil end
- v[2].CFrame=CFrame.new(v[1].Position,v[1].Position+v[1].Velocity)
- local Hit,Pos,NID,Mat=Raycast(v[1].Position,v[1].Velocity,{Char},v[1].Velocity.Magnitude/6,true)
- if Mat then
- v[1].Parent=nil
- CSFuncs:Fire("S","Impact",{Hit,Pos})
- Rocks[i]=nil
- end
- end
- end
- end)
- Effects.ChildAdded:Connect(function(C)
- if C.Name=="GODDAMNROCK" then
- Instance.Remove(Instance.new("BodyVelocity",{MaxForce=Vector3.new(math.huge,math.huge,math.huge),Velocity=C.CFrame.LookVector*350,Parent=C}),.2)
- local Gyr=Instance.new("BodyGyro",{D=250,P=5000,MaxTorque=Vector3.new(math.huge,math.huge,math.huge),CFrame=CFrame.new(C.Position,C.Position+C.Velocity),Parent=C})
- local Hit,Pos,NID,Mat=Raycast(C.Position,C.CFrame.LookVector,{Char},5,true)
- if Mat then
- C.Parent=nil
- CSFuncs:Fire("S","Impact",{Hit,Pos})
- return
- end
- table.insert(Rocks,{C,Gyr})
- end
- end)
- Rem.OnClientEvent:Connect(function(Name,...)
- return CSFuncs:Trigger("Event",Name,...)
- end)
- InfoRef.OnClientInvoke=function(Name,...)
- return CSFuncs:Trigger("Function",Name,...)
- end
- while wait(1/30) do
- Rem:FireServer({Mouse=true,Hit=Mouse.Hit,Target=Mouse.Target,Origin=Mouse.Origin})
- end
- ]==],script) Client.Disabled=true
- Client.Name="SClient"
- local math=setmetatable({random=function(Arg1,Arg2,DIV) DIV=DIV or 1 return math.random(Arg1*DIV,Arg2*DIV)/DIV end,CosSin=function(Arg) return (math.sin(Arg/2)*math.cos(Arg/2)) end,},{__index=math,})
- local CFrame=setmetatable({Angles=function(Arg1,Arg2,Arg3,Angles) if not Angles then return CFrame.Angles(Arg1,Arg2,Arg3) else return CFrame.Angles(math.rad(Arg1),math.rad(Arg2),math.rad(Arg3)) end end,},{__index=CFrame,})
- local Instance=setmetatable({new=function(type,args) local instance=Instance.new(type) if args then if string.lower(typeof(args)) == "instance" then instance.Parent=args elseif string.lower(typeof(args))=="table" then for i,v in pairs(args) do pcall(function() instance[i]=v end) end end end return instance end,Remove=function(Instance_,Time) if string.lower(typeof(Instance_))=="instance" then game:GetService("Debris"):AddItem(Instance_,Time or 0) elseif string.lower(typeof(Instance_))=="table" then table.foreach(Instance_,function(_,v) game:GetService("Debris"):AddItem(v,Time or 0) end) end end},{__index=Instance,})
- local Player,UIS,Mouse,CrossClient=owner,nil,nil,nil
- do
- Instance.new("RemoteFunction",{Name="InfoRef",Parent=Instance.new("RemoteEvent",{Name="Input",Parent=Client})})
- Instance.new("BoolValue",{Name="HeadFollow",Value=true,Parent=Client})
- local Rem=Client:WaitForChild("Input",5)
- local InfoRef=Rem:WaitForChild("InfoRef",5)
- local function NewEv(MultipleFuncs)
- local Table={FE=true}
- if MultipleFuncs then
- Table.Funcs={}
- end
- Table.Connect=function(self,Name,Func) -- t:Connect(nil,...) nil - skip indexing and keep it as a rewritable function
- local T={}
- local TableFuncs=Name~=nil
- if not TableFuncs then
- self.Function=Func
- else
- self.Funcs[Name]=Func
- end
- T.Disconnect=function(self)
- if not TableFuncs then
- self.Function=nil
- else
- self.Funcs[Name]=nil
- end
- end
- T.disconnect=T.Disconnect
- return T
- end
- Table.connect=Table.Connect
- return Table
- end
- CrossClient={Events=NewEv(true),Functions=NewEv(true)}
- UIS={InputBegan=NewEv(),InputEnded=NewEv()}
- Mouse={Hit=CFrame.new(),Target=CFrame.new(),Origin=CFrame.new()}
- local function FireEUIS(self,Name,...)
- local F=UIS[Name]
- if F and F.FE then
- if F.Function then
- F.Function(...)
- elseif F.Funcs then
- for i,v in pairs(F.Funcs) do
- v(...)
- end
- end
- end
- end
- CrossClient.AddFunction=function(self,Type,Name,Function)
- if not self then return end
- if type(Name)=="function" then Function=Name Name=nil end
- assert(CrossClient[Type.."s"],"unsupported event type")
- if Name then
- CrossClient[Type.."s"][Name]=Function
- else
- table.insert(CrossClient[Type.."s"],Function)
- end
- end
- CrossClient.RemoveFunction=function(self,Type,Name)
- if not self then return end
- assert(CrossClient[Type.."s"],"unsupported event type")
- assert(Name,"no event name given")
- CrossClient[Type.."s"][Name]=nil
- end
- CrossClient.RemoveFunction=function(self,Type,Name)
- if not self then return end
- assert(CrossClient[Type.."s"],"unsupported event type")
- assert(Name,"no event name given")
- CrossClient[Type.."s"][Name]=nil
- end
- CrossClient.FireClient=function(self,Type,Name,...)
- if not self then return end
- assert(CrossClient[Type.."s"],"unsupported event type")
- assert(Name,"no event name given")
- if Type=="Event" then
- return Rem:FireClient(Player,Name,...)
- elseif Type=="Function" then
- return InfoRef:InvokeClient(Player,Name,...)
- end
- end
- UIS.FireEv=FireEUIS
- InfoRef.OnServerInvoke=function(PLR,...)
- if PLR~=Player then return end
- local Args={...}
- if Args[1]=="R" then
- return CrossClient.Functions[Args[2]](Args[3])
- end
- end
- Rem.OnServerEvent:Connect(function(PLR,IO,L,...)
- if PLR~=Player then return end
- local Args={...}
- local Ret=false
- if #Args>0 then
- if Args[1]=="S" then
- Ret=true
- return CrossClient.Events[Args[2]](Args[3])
- end
- end
- if Ret then return end
- if IO.Mouse then
- Mouse.Hit=IO.Hit
- Mouse.Target=IO.Target
- Mouse.Origin=IO.Origin
- else
- if IO.UserInputState==Enum.UserInputState.Begin then
- UIS:FireEv("InputBegan",IO,L)
- else
- UIS:FireEv("InputEnded",IO,L)
- end
- end
- end)
- Client.Disabled=false
- end
- --// Shortcuts
- local ins=Instance.new
- local v3=Vector3.new
- local v2=Vector2.new
- local cf=CFrame.new
- local angles=CFrame.Angles
- local ud=UDim.new
- local ud2=UDim2.new
- local c3=Color3.new
- local rgb=Color3.fromRGB
- local hsv=Color3.fromHSV
- local bc=BrickColor.new
- local bcRandom=BrickColor.Random
- local palette=BrickColor.palette
- local cs=ColorSequence.new
- local ns=NumberSequence.new
- local nsk=NumberSequenceKeypoint.new
- local nr=NumberRange.new
- local random=math.random
- local rad=math.rad
- local sin=math.sin
- local cos=math.cos
- local tan=math.tan
- local cotan=math.CosSin
- local floor=math.floor
- local pi=math.floor
- local abs=math.abs
- local sqrt=math.sqrt
- local clamp=math.clamp
- local ray=Ray.new
- local huge=math.huge
- --// Basic functions
- function Tween(Object,Args,Info)
- if Object and Args then
- Info = Info or TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0)
- if typeof(Info) == "table" then Info = TweenInfo.new(unpack(Info)) end
- game:GetService("TweenService"):Create(Object,Info,Args):Play()
- end
- end
- function Sound(Id,Volume,Pitch,Parent,MaxDistance,EmitterSize,Looped)
- local S=ins("Sound",{Volume=Volume or 1,Pitch=Pitch or 1,MaxDistance=MaxDistance or 500,EmitterSize=EmitterSize or 5,Looped=Looped or false,SoundId="rbxassetid://"..Id,Parent=Parent})
- S:Play()
- coroutine.wrap(function()
- if S.Looped then return end
- if S.IsLoaded then
- Instance.Remove(S,S.TimeLength/S.Pitch)
- else
- S.Loaded:Connect(function()
- Instance.Remove(S,S.TimeLength/S.Pitch)
- end)
- end
- end)()
- return S
- end
- function Raycast(Origin,Direction,Blacklist,MaxDistance,IgnoreWater)
- return workspace:FindPartOnRayWithIgnoreList(ray(Origin,Direction.Unit*MaxDistance),Blacklist or {},false,IgnoreWater)
- end
- --// Setup 1
- for i,v in pairs(Player.Character:GetDescendants()) do
- if (v.Name=="Animate" and v:IsA("LocalScript")) or v:IsA("Animator") then
- Instance.Remove(v)
- end
- end
- --// Character indexing
- local LockWS,LockJP=false,false
- local Type="R6"
- local Char,char=Player.Character,Player.Character
- local Hum,hum=Char:FindFirstChildOfClass("Humanoid"),Char:FindFirstChildOfClass("Humanoid")
- local hrp,HRP=Char.HumanoidRootPart,Char.HumanoidRootPart
- local h,t,ra,la,rl,ll
- local nec,rs,ls,rh,lh,rutj
- local necC0,necC1=cf(),cf()
- local rutjC0,rutjC1=cf(),cf()
- local rsC0,rsC1=cf(),cf()
- local lsC0,lsC1=cf(),cf()
- local rhC0,rhC1=cf(),cf()
- local lhC0,lhC1=cf(),cf()
- local h,ut,lt,rua,rla,rh,lua,lla,lh,rul,rll,rf,lul,lll,lf
- local CFs={}
- local Joints={}
- if Type=="R6" then
- h,t,ra,la,rl,ll=char.Head,char.Torso,char["Right Arm"],char["Left Arm"],char["Right Leg"],char["Left Leg"]
- nec,rutj,rs,ls,rh,lh=t.Neck,hrp.RootJoint,t["Right Shoulder"],t["Left Shoulder"],t["Right Hip"],t["Left Hip"]
- necC0,necC1=cf(0,t.Size.Y/2,0),cf(0,-h.Size.Y/2,0)
- rutjC0,rutjC1=cf(0,0,0),cf(0,0,0)
- rsC0,rsC1=cf(t.Size.X/2,t.Size.Y/4,0),cf(-ra.Size.X/2,ra.Size.Y/4,0)
- lsC0,lsC1=cf(-t.Size.X/2,t.Size.Y/4,0),cf(la.Size.X/2,la.Size.Y/4,0)
- rhC0,rhC1=cf(t.Size.X/4,-t.Size.Y/2,0),cf(0,rl.Size.Y/2,0)
- lhC0,lhC1=cf(-t.Size.X/4,-t.Size.Y/2,0),cf(0,ll.Size.Y/2,0)
- Instance.Remove({nec,rutj,rs,ls,rh,lh})
- nec=ins("Motor6D",{Name="Neck",Part0=t,Part1=h,C0=necC0,C1=necC1,Parent=t,})
- rutj=ins("Motor6D",{Name="RootJoint",Part0=hrp,Part1=t,C0=rutjC0,C1=rutjC1,Parent=hrp,})
- rs=ins("Motor6D",{Name="Right Shoulder",Part0=t,Part1=ra,C0=rsC0,C1=rsC1,Parent=t,})
- ls=ins("Motor6D",{Name="Left Shoulder",Part0=t,Part1=la,C0=lsC0,C1=lsC1,Parent=t,})
- rh=ins("Motor6D",{Name="Right Hip",Part0=t,Part1=rl,C0=rhC0,C1=rhC1,Parent=t,})
- lh=ins("Motor6D",{Name="Left Hip",Part0=t,Part1=ll,C0=lhC0,C1=lhC1,Parent=t,})
- elseif Type=="R15" then
- h,hrp=Char.Head,Char.HumanoidRootPart
- ut,lt=Char.UpperTorso,Char.LowerTorso
- rua,rla,rh=Char.RightUpperArm,Char.RightLowerArm,Char.RightHand
- lua,lla,lh=Char.LeftUpperArm,Char.LeftLowerArm,Char.LeftHand
- rul,rll,rf=Char.RightUpperLeg,Char.RightLowerLeg,Char.RightFoot
- lul,lll,lf=Char.LeftUpperLeg,Char.LeftLowerLeg,Char.LeftFoot
- for i,v in pairs(Char:GetDescendants()) do
- if v:IsA("Motor6D") then
- local CFData={C0=cf(v.C0.Position),C1=cf(v.C1.Position),Part0=v.Part0,Part1=v.Part1,Parent=v.Parent}
- local Joint=ins("Motor6D",{C0=CFData.C0,C1=CFData.C1,Part0=CFData.Part0,Part1=CFData.Part1,Name=v.Name,Parent=CFData.Parent,})
- CFs[v.Name]=CFData
- Joints[v.Name]=setmetatable({Object=Joint,Link=CFData,Remove=function(Time) Instance.Remove(Joint,Time) end},{__index=Joint,__newindex=function(self,k,v) Joint[k]=v end})
- v.Parent=nil
- Instance.Remove(v)
- end
- end
- end
- --// Variables
- local Using,Muted,Hold=false,false,false
- local Sine=0
- local Change=1
- local WS,JP=16,50
- local TimePos=0
- local PullTick=tick()
- local Step="R"
- local FreeParts,BusyParts={Rocks={},Explosions={}},{}
- local Rocks,Explosions=10,10
- local StepSounds={Glass=4085889170,Plastic=2812418291,SmoothPlastic=2812418291,Neon=2812418291,ForceField=2812418291,Metal=2812417769,DiamondPlate=2812417769,CorrodedMetal=2812417769,Foil=2812417769,Sand=4085867669,Grass=619188333,Slate=2812418291,Concrete=2812418291,Granite=2812418291,Pebble=2812418291,Marble=2812418291,Cobblestone=2812418291,Brick=2812418291,Water=1110489303,Wood=2812419402,WoodPlanks=2812419402,Fabric=133705377,Snow=619083295}
- local Poses={CFrame.Angles(-2.5,0,0,true),cf(0,0,0),cf(-0.1,-0.1,0.05)*angles(5,10,-2.5,true),cf(0.1,-0.1,0.05)*angles(5,-10,2.5,true),cf(0,0,-0.05)*angles(-1,-2.5,1.5,true),cf(0,0,-0.05)*angles(-1,2.5,-1.5,true)}
- --// Setup 2
- local Effects=ins("Folder",{Name="Effects",Parent=Char,})
- ins("ForceField",{Parent=char,Visible=false,})
- local FootstepR=Sound(1941274854,6,1,rl,250,5,true) FootstepR.Looped=false FootstepR:Stop()
- local FootstepL=Sound(1941274854,6,1,ll,250,5,true) FootstepL.Looped=false FootstepL:Stop()
- local Mus=Sound(6153847391,1.25,1,t,150,5,true)
- local Prep=Sound(5568128427,1.5,1,h,150,5,true) Prep.Looped=false Prep:Stop()
- local Reload
- local BPU,BPD,BP={},{},{}
- local Bo=ins("Model",{Name="rocK",Parent=t})
- local BowHandle=ins("Part",{Size=v3(.225,1,.225),CanCollide=false,Anchored=false,Massless=true,Locked=true,Color=rgb(150,150,150),Material="Slate",Parent=Bo})
- local Rock=ins("Part",{Size=v3(.356,.356,3.338),CanCollide=false,Anchored=false,Massless=true,Locked=true,Parent=Bo})
- local BHM=ins("CylinderMesh",BowHandle)
- local RM=ins("SpecialMesh",{MeshId="rbxassetid://6163504268",TextureId="rbxassetid://6163510254",Parent=Rock})
- local HW=ins("Motor6D",{Part0=ra,Part1=Rock,C0=cf(-.1,-.85,0),C1=cf(0,0,1.25),Parent=Bo})
- local BW=ins("Motor6D",{Part0=Rock,Part1=BowHandle,C0=cf(0,0,-1.5),Parent=Rock})
- local SP=ins("Part",{Size=v3(),CanCollide=false,Anchored=false,Massless=true,Locked=true,Transparency=1,Parent=Bo})
- local SPW=ins("Motor6D",{Part0=BowHandle,Part1=SP,C1=cf(0,0,-1),Parent=BowHandle})
- for i=1,3 do
- local AttPart=i==1 and BowHandle or BPU[#BPU][1]
- local P=ins("Part",{Size=v3(.225-(i*.025),1,.225-(i*.025)),CanCollide=false,Anchored=false,Massless=true,Locked=true,Color=bc("Brown").Color,Material="Wood",Name=i==3 and "Top" or "meh",Parent=Bo})
- ins("CylinderMesh",P)
- local W=ins("Motor6D",{Part0=AttPart,Part1=P,C0=cf(0,AttPart.Size.Y/2,0)*angles(10,0,0,true),C1=cf(0,-P.Size.Y/2,0),Parent=P})
- if i==3 then BPU.Top={P,W,cf(0,AttPart.Size.Y/2,0)*angles(10,0,0,true)} else table.insert(BPU,{P,W,cf(0,AttPart.Size.Y/2,0)*angles(10,0,0,true)}) end
- end
- for i=1,3 do
- local AttPart=i==1 and BowHandle or BPD[#BPD][1]
- local P=ins("Part",{Size=v3(.225-(i*.025),1,.225-(i*.025)),CanCollide=false,Anchored=false,Massless=true,Locked=true,Color=bc("Brown").Color,Material="Wood",Name=i==3 and "Bottom" or "meh",Parent=Bo})
- ins("CylinderMesh",P)
- local W=ins("Motor6D",{Part0=AttPart,Part1=P,C0=angles(0,0,i==1 and 180 or 0,true)*cf(0,AttPart.Size.Y/2,0)*angles(10,0,0,true),C1=cf(0,-P.Size.Y/2,0),Parent=P})
- if i==3 then BPD.Bottom={P,W,angles(0,0,i==1 and 180 or 0,true)*cf(0,AttPart.Size.Y/2,0)*angles(10,0,0,true)} else table.insert(BPD,{P,W,angles(0,0,i==1 and 180 or 0,true)*cf(0,AttPart.Size.Y/2,0)*angles(10,0,0,true)}) end
- end
- for i,v in pairs(BPU) do BP[i]=v end
- for i,v in pairs(BPD) do BP[i]=v end
- BPU,BPD=nil,nil
- local A1,A2,A3=ins("Attachment",{Position=v3(),Parent=SP}),ins("Attachment",{Position=v3(0,.5,0),Parent=BP.Top[1]}),ins("Attachment",{Position=v3(0,.5,0),Parent=BP.Bottom[1]})
- local B1,B2=ins("Beam",{FaceCamera=true,Transparency=ns(0),Attachment0=A2,Attachment1=A1,Width0=.09,Width1=.09,LightInfluence=1,Parent=A2}),ins("Beam",{FaceCamera=true,Transparency=ns(0),Attachment0=A3,Attachment1=A1,Width0=.09,Width1=.09,LightInfluence=1,Parent=A2})
- for i=1,Rocks do
- local P=ins("Part",{Size=v3(.356,.356,3.338),CanCollide=false,Anchored=false,Massless=true,Locked=true,Name="GODDAMNROCK"})
- local M=ins("SpecialMesh",{MeshId="rbxassetid://6163504268",TextureId="rbxassetid://6163510254",Name="MESH",Parent=P})
- table.insert(FreeParts.Rocks,{P,M})
- end
- for i=1,Explosions do
- local P=ins("Part",{Size=v3(),CanCollide=false,Anchored=true,Massless=true,Locked=true})
- local S=Sound(4921099862,1.5,1,P,250,6,true) S:Stop() S.Looped=false S.Name="SOUND"
- local Exp=ins("Explosion")
- Exp.Hit:Connect(function(P,D)
- if not P or not P:IsA("BasePart") or P:IsDescendantOf(char) then return end
- P:BreakJoints()
- end)
- table.insert(FreeParts.Explosions,{P,S,Exp}) --4921099862 6056117937
- end
- --// Functions
- function PlayAnimSingle(...)
- local Joints_={nec=nec,rutj=rutj,rs=rs,ls=ls,rh=rh,lh=lh}
- local CFs_={necC0=necC0,necC1=necC1,rutjC0=rutjC0,rutjC1=rutjC1,rsC0=rsC0,rsC1=rsC1,lsC0=lsC0,lsC1=lsC1,rhC0=rhC0,rhC1=rhC1,lhC0=lhC0,lhC1=lhC1,hamC0=cf(),hamC1=cf(-.1,.1,.85)*angles(90,0,0,true)}
- for i,v in pairs({...}) do
- if Joints_[v[1]] then
- local T={}
- table.foreach(v[2],function(i,v) T[i]=v end)
- local C0=((CFs_[v[1].."C0"] or cf(0,0,0))*(T.C0 or cf(0,0,0))) or CFs_[v[1].."C0"]
- local C1=((CFs_[v[1].."C1"] or cf(0,0,0))*((T.C1 or cf(0,0,0))):Inverse())
- for i,v in pairs(T) do if i=="C0" then T.C0=C0 elseif i=="C1" then T.C1=C1 end end
- Tween(Joints_[v[1]],T,v[3])
- end
- end
- end
- function PlayAnim(Table,AddFuncs)
- AddFuncs=AddFuncs or {}
- local Waits=Table.Waits
- for i=1,#Table do
- local v=Table[i]
- if i~="Waits" and Waits[i] then
- local WaitTime=Waits[i]
- PlayAnimSingle(unpack(v))
- wait(WaitTime)
- if AddFuncs[i] then AddFuncs[i]() end
- end
- end
- end
- function TakeCached(Tab,Dur)
- if #Tab==0 then return warn("no available objects") end
- local Obj=Tab[#Tab]
- Tab[#Tab]=nil
- local Conn
- Conn=Obj[1].AncestryChanged:Connect(function(A)
- if not Obj[1].Parent then
- Conn:Disconnect()
- table.insert(Tab,Obj)
- Obj[1].Parent=nil
- Conn="fuc"
- end
- end)
- coroutine.wrap(function()
- if not Dur then return end
- wait(Dur)
- if Conn=="fuc" then return end
- Conn:Disconnect()
- table.insert(Tab,Obj)
- Obj[1].Parent=nil
- end)()
- return setmetatable(Obj,{__call=function(self) table.insert(Tab,Obj) Obj[1].Parent=nil end,__index=Obj})
- end
- --// Moves
- --// Connections
- CrossClient:AddFunction("Event","Impact",function(T)
- local Hit,Pos=T[1],T[2]
- local Obj=TakeCached(FreeParts.Explosions,5)
- if Obj then
- Obj[1].CFrame=cf(Pos)
- Obj[2].SoundId="rbxassetid://"..(math.random(0,1,10)==1 and 6056117937 or 4921099862)
- Obj[1].Parent=Effects
- Obj[2]:Play()
- if Obj[2].SoundId=="rbxassetid://6056117937" then
- Obj[2].TimePosition=.85
- coroutine.wrap(function()
- wait(Obj[2].TimeLength-1.6)
- Obj[3].Parent=Obj[1]
- Obj[3].BlastPressure=5000000
- Obj[3].Position=Pos
- wait(2)
- Obj[1].Parent=nil
- end)()
- else
- coroutine.wrap(function()
- Obj[3].Parent=Obj[1]
- Obj[3].BlastPressure=500000
- Obj[3].Position=Pos
- wait(2)
- Obj[1].Parent=nil
- end)()
- end
- else
- Instance.Remove(ins("Explosion",{Position=Pos,Parent=Effects}),2.5)
- end
- end)
- UIS.InputBegan:Connect(nil,function(IO,L)
- if L then return end
- if IO.UserInputType==Enum.UserInputType.Keyboard then
- if IO.KeyCode==Enum.KeyCode.M then
- Muted=not Muted
- end
- elseif IO.UserInputType==Enum.UserInputType.MouseButton1 and Rock.Transparency~=1 then
- CrossClient:FireClient("Event","ToggleTTM",true)
- Prep:Play()
- Hold=true
- PullTick=tick()
- end
- end)
- UIS.InputEnded:Connect(nil,function(IO,L)
- if IO.UserInputType==Enum.UserInputType.MouseButton1 and Rock.Transparency~=1 and Hold then
- if tick()-PullTick>.2 then
- CrossClient:FireClient("Event","ToggleTTM",false)
- Prep:Stop()
- PullTick=tick()
- local Obj=TakeCached(FreeParts.Rocks,5)
- if Obj then
- Obj[1].CFrame=cf(Rock.Position,Mouse.Hit.Position)
- Obj[1].Parent=Effects
- pcall(function()
- Obj[1]:SetNetworkOwner(Player)
- end)
- end
- Hold=false
- Rock.Transparency=1
- BW.C0=BW.C0*cf(0,0,2)*angles(random(-180,180,10),random(-180,180,10),random(-180,180,10),true)
- Sound(145203279,1.5,random(.9,1.1,100),Rock,100,5)
- for i,v in pairs(BP) do
- v[2].C0=v[2].C0*angles(random(-180,180,10),random(-180,180,10),random(-180,180,10),true)
- end
- else
- Prep:Stop()
- CrossClient:FireClient("Event","ToggleTTM",false)
- Hold=false
- end
- end
- end)
- game:GetService("RunService").Heartbeat:Connect(function()
- if not FootstepR or not FootstepR.Parent then FootstepR=Sound(1941274854,6,1,rl,250,5,true) FootstepR.Looped=false FootstepR:Stop() end
- if not FootstepL or not FootstepL.Parent then FootstepL=Sound(1941274854,6,1,ll,250,5,true) FootstepL.Looped=false FootstepL:Stop() end
- if not Prep or not Prep.Parent then Prep=Sound(5568128427,1.5,1,h,150,5,true) Prep.Looped=false Prep:Stop() end
- if not Reload or not Reload.Parent then Reload=Sound(506273075,.75,1,Rock,150,5,true) Reload.Looped=false Reload:Stop() end
- if not Mus or not Mus.Parent then Mus=Sound(6153847391,Muted and 0 or 1.25,1,t,150,5,true) Mus.TimePosition=TimePos end
- Mus.SoundId,Mus.Volume,Mus.Pitch="rbxassetid://"..4673981188,Muted and 0 or .85,1
- TimePos=Mus.TimePosition
- Sine=Sine+Change
- local Direction=hum.MoveDirection
- if Direction.Magnitude==0 then Direction=hrp.Velocity/7.5 end;
- local MoveZ=clamp((Direction*t.CFrame.LookVector).X+(Direction*t.CFrame.LookVector).Z,-1,1)
- local MoveX=clamp((Direction*t.CFrame.RightVector).X+(Direction*t.CFrame.RightVector).Z,-1,1)
- local Moving=(hrp.Velocity*v3(1,0,1)).Magnitude>1
- local VerY=hrp.Velocity.Y
- local StandR,RPos,RNID=Raycast(t.CFrame*cf(t.Size.X/4,-t.Size.Y/2,0).Position,-t.CFrame.UpVector,{char},3,false)
- local StandL,LPos,LNID=Raycast(t.CFrame*cf(-t.Size.X/4,-t.Size.Y/2,0).Position,-t.CFrame.UpVector,{char},3,false)
- local Stand=StandR or StandL
- if not Hold and tick()-PullTick>.25 and Rock.Transparency==1 then
- Rock.Transparency=0
- Reload.Pitch=random(.9,1.1,100)
- Reload:Play()
- end
- --hum.WalkSpeed,hum.JumpPower=WS,JP
- if not Moving and Stand then
- local IdleVal=(tan(Sine/10)*cos(Sine/35))*20
- Change=1
- nec.C0=nec.C0:Lerp(necC0*cf(0,0,0)*angles(sin(Sine/IdleVal)*6,cotan(Sine/(IdleVal*3))*22.5,0,true)*Poses[1]*(Hold and (angles(0,50,0,true)*angles(0,0,-25,true)) or cf()),.25)
- rutj.C0=rutj.C0:Lerp(rutjC0*cf(0,.15*cos(Sine/IdleVal),.15*cotan(Sine/IdleVal))*angles(cotan(Sine/IdleVal)*6,sin(Sine/(IdleVal*3.5))*7.5,cotan(Sine/(IdleVal*2))*-12,true)*Poses[2]*(Hold and (angles(0,-50,0,true)) or cf()),.25)
- rs.C0=rs.C0:Lerp(rsC0*cf(0,-.15*cos(Sine/IdleVal),0)*angles(sin(Sine/IdleVal)*6.75,-sin(Sine/(IdleVal*3.5))*7.5,sin(Sine/IdleVal)*4.5,true)*Poses[3]*(Hold and (CFrame.new(0.1,0,0.25)*CFrame.Angles(math.rad(0),math.rad(50),math.rad(0))*CFrame.Angles(math.rad(90),math.rad(20),math.rad(-10))*cf(0,.2,0)) or cf()),.25)
- ls.C0=ls.C0:Lerp(lsC0*cf(0,-.15*cos(Sine/IdleVal),0)*angles(sin(Sine/IdleVal)*6.75,-sin(Sine/(IdleVal*3.5))*7.5,sin(Sine/IdleVal)*-4.5,true)*Poses[4]*(Hold and (CFrame.new(0,0,-0.6)*CFrame.Angles(math.rad(0),math.rad(50),math.rad(0))*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-10))*cf(0,-.2,0)) or cf()),.25)
- rh.C0=rh.C0:Lerp(rhC0*cf(0,-.15*cos(Sine/IdleVal)+.075*cotan(Sine/(IdleVal*2)),0)*angles(cotan(Sine/IdleVal)*-6+sin(Sine/(IdleVal*10.5))*-3.75,0,cotan(Sine/(IdleVal*2))*19.5,true)*Poses[5]*(Hold and (angles(0,-5,0,true)) or cf()),.25)
- lh.C0=lh.C0:Lerp(lhC0*cf(0,-.15*cos(Sine/IdleVal)-.075*cotan(Sine/(IdleVal*2)),0)*angles(cotan(Sine/IdleVal)*-6+sin(Sine/(IdleVal*10.5))*3.65,0,cotan(Sine/(IdleVal*2))*19.5,true)*Poses[6]*(Hold and (angles(0,50,0,true)) or cf()),.25)
- HW.C0=HW.C0:Lerp(cf(-.1,-.85-(Hold and Rock.Size.Z*.25 or 0),0)*angles(Hold and -90 or 0,0,0,true),.25)
- BW.C0=BW.C0:Lerp(cf(0,0,Hold and -.4 or Rock.Transparency~=0 and 1.5 or -1.5),.25)
- RM.Scale=RM.Scale:Lerp(v3(1,1,Hold and 1.25 or 1),.25)
- SPW.C0=SPW.C0:Lerp(cf(0,0,Hold and 1.5 or 0),.25)
- for i,v in pairs(BP) do
- v[2].C0=v[2].C0:Lerp(v[3]*angles(Hold and 10 or Rock.Transparency~=0 and -10 or 0,0,0,true),.25)
- end
- elseif Moving and Stand then
- local WSVal=4/clamp(hum.WalkSpeed/16,.25,2)*t.Size.Y/2
- local WSMul=(1+(WSVal/4))
- Change=1
- nec.C0=nec.C0:Lerp(necC0*cf(0,0,0)*angles(sin(Sine/(WSVal/2))*115,0,0,true)*cf(0,0,0)*angles(5*MoveZ,-60*MoveX,0,true)*(Hold and (angles(0,50,0,true)*angles(0,0,-25,true)) or cf()),.35/(t.Size.Y/2)*(hum.WalkSpeed/16)/3) --*cf((VerY/7.5)*MoveX,1*clamp(abs(VerY),0,1),(-VerY/7.5)*MoveZ)
- rutj.C0=rutj.C0:Lerp(rutjC0*cf(0,-2,0)*angles(VerY*2.5*MoveZ,0,VerY*2.5*MoveX,true)*cf(0,2,0)*cf(0,2.5*cos(Sine/(WSVal/2)),0)*angles(cotan(Sine/(WSVal/2))*225,sin(Sine/WSVal)*10,0,true)*cf(0,0,0)*angles(-10*MoveZ,0,-10*MoveX,true)*(Hold and (angles(0,-50,0,true)) or cf()),.35/(t.Size.Y/2)*(hum.WalkSpeed/16)/3)
- rs.C0=rs.C0:Lerp(rsC0*cf(0,0,.5*sin(Sine/WSVal)*MoveZ)*angles(-cotan(Sine/WSVal)*330*MoveZ*(Hold and 0 or 1),0,0,true)*angles(0,-cotan(Sine/WSVal)*70*MoveZ*(Hold and 0 or 1),0,true)*cf(-.15*(Hold and 0 or 1),0,0)*angles(10*(Hold and 0 or 1),0,-10*abs(MoveZ)*(Hold and 0 or 1),true)*(Hold and (CFrame.new(0.1,0,0.25)*CFrame.Angles(math.rad(0),math.rad(50),math.rad(0))*CFrame.Angles(math.rad(90),math.rad(20),math.rad(-10))*cf(0,.2,0)) or cf()),.35/(t.Size.Y/2)*(hum.WalkSpeed/16)/3)
- ls.C0=ls.C0:Lerp(lsC0*cf(0,0,-.5*sin(Sine/WSVal)*MoveZ)*angles(cotan(Sine/WSVal)*330*MoveZ*(Hold and 0 or 1),0,0,true)*angles(0,-cotan(Sine/WSVal)*70*MoveZ*(Hold and 0 or 1),0,true)*cf(.15*(Hold and 0 or 1),0,0)*angles(10*(Hold and 0 or 1),0,10*abs(MoveZ)*(Hold and 0 or 1),true)*(Hold and (CFrame.new(0,0,-0.6)*CFrame.Angles(math.rad(0),math.rad(50),math.rad(0))*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-10))*cf(0,-.2,0)) or cf()),.35/(t.Size.Y/2)*(hum.WalkSpeed/16)/3)
- rh.C0=rh.C0:Lerp(rhC0*cf(0,.1+.75*cos(Sine/WSVal),-.2-.9*cos(Sine/WSVal))*angles(cotan(Sine/WSVal)*250*MoveZ,0,cotan(Sine/WSVal)*200*MoveX,true)*cf(0,0,0)*angles(7.5*abs(MoveZ),0,0,true)*(Hold and (angles(0,-5,0,true)) or cf()),.35/(t.Size.Y/2)*(hum.WalkSpeed/16)/3)
- lh.C0=lh.C0:Lerp(lhC0*cf(0,.1+-.75*cos(Sine/WSVal),-.2+.9*cos(Sine/WSVal))*angles(-cotan(Sine/WSVal)*250*MoveZ,0,-cotan(Sine/WSVal)*200*MoveX,true)*cf(0,0,0)*angles(7.5*abs(MoveZ),0,0,true)*(Hold and (angles(0,50,0,true)) or cf()),.35/(t.Size.Y/2)*(hum.WalkSpeed/16)/3)
- HW.C0=HW.C0:Lerp(cf(-.1,-.85-(Hold and Rock.Size.Z*.25 or 0),0)*angles(Hold and -90 or 0,0,0,true),.35/(t.Size.Y/2)*(hum.WalkSpeed/16)/3)
- BW.C0=BW.C0:Lerp(cf(0,0,Hold and -.4 or Rock.Transparency~=0 and 1.5 or -1.5),.35/(t.Size.Y/2)*(hum.WalkSpeed/16)/3)
- RM.Scale=RM.Scale:Lerp(v3(1,1,Hold and 1.25 or 1),.35/(t.Size.Y/2)*(hum.WalkSpeed/16)/3)
- SPW.C0=SPW.C0:Lerp(cf(0,0,Hold and 1.5 or 0),.35/(t.Size.Y/2)*(hum.WalkSpeed/16)/3)
- for i,v in pairs(BP) do
- v[2].C0=v[2].C0:Lerp(v[3]*angles(Hold and 10 or Rock.Transparency~=0 and -10 or 0,0,0,true),.35/(t.Size.Y/2)*(hum.WalkSpeed/16)/3)
- end
- --thanks to kyu or neb.. whatever
- if cos(Sine/WSVal)/2>.2 and Step=="L" then
- Step="R"
- if StandR then
- FootstepR.Pitch=random(.9,1.1,100)
- FootstepR:Play()
- end
- end
- if cos(Sine/WSVal)/2<-.2 and Step=="R" then
- Step="L"
- if StandL then
- FootstepL.Pitch=random(.9,1.1,100)
- FootstepL:Play()
- end
- end
- elseif not Stand then
- Change=1
- nec.C0=nec.C0:Lerp(necC0*cf(0,0,0)*angles(0,0,0,true)*cf(0,0,0)*angles(clamp(hrp.Velocity.Y,-15,15),0,0,true),.2)
- rutj.C0=rutj.C0:Lerp(rutjC0*cf(0,0,0)*angles(0,0,0,true)*cf(0,0,0)*angles(clamp(hrp.Velocity.Y,-30,20),0,0,true),.2)
- rs.C0=rs.C0:Lerp(rsC0*cf(0,0,0)*angles(0,5,-7.5,true)*cf(-(clamp(hrp.Velocity.Y/20,-.45,0)),0,0)*angles((clamp(hrp.Velocity.Y*4,0,150)),0,-(clamp(hrp.Velocity.Y*4,-120,0)),true),.2)
- ls.C0=ls.C0:Lerp(lsC0*cf(0,0,0)*angles(0,-5,7.5,true)*cf((clamp(hrp.Velocity.Y/20,-.45,0)),0,0)*angles((clamp(hrp.Velocity.Y*4,0,150)),0,(clamp(hrp.Velocity.Y*4,-120,0)),true),.2)
- rh.C0=rh.C0:Lerp(rhC0*cf(0,0,0)*angles(0,0,0,true)*cf(0,.4,-.35)*angles(-10,-5,5,true),.2)
- lh.C0=lh.C0:Lerp(lhC0*cf(0,0,0)*angles(clamp(-hrp.Velocity.Y,-25,35),0,0,true)*cf(0,.2,-.15)*angles(-2.5,5,-5,true),.2)
- end
- if Type=="R6" then
- nec.C1=nec.C1:Lerp(necC1,.2)
- rutj.C1=rutj.C1:Lerp(rutjC1,.2)
- rs.C1=rs.C1:Lerp(rsC1,.2)
- ls.C1=ls.C1:Lerp(lsC1,.2)
- rh.C1=rh.C1:Lerp(rhC1,.2)
- lh.C1=lh.C1:Lerp(lhC1,.2)
- necC0,necC1=cf(0,t.Size.Y/2,0),cf(0,-h.Size.Y/2,0)
- rutjC0,rutjC1=cf(0,0,0),cf(0,0,0)
- rsC0,rsC1=cf(t.Size.X/2,t.Size.Y/4,0),cf(-ra.Size.X/2,ra.Size.Y/4,0)
- lsC0,lsC1=cf(-t.Size.X/2,t.Size.Y/4,0),cf(la.Size.X/2,la.Size.Y/4,0)
- rhC0,rhC1=cf(t.Size.X/4,-t.Size.Y/2,0),cf(0,rl.Size.Y/2,0)
- lhC0,lhC1=cf(-t.Size.X/4,-t.Size.Y/2,0),cf(0,ll.Size.Y/2,0)
- end
- end)
Add Comment
Please, Sign In to add comment