Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://github.com/Mokiros/roblox-FE-compatibility
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- print("FE Compatibility code V2 by Mokiros")
- local RealPlayer = RealPlayer
- script.Parent = RealPlayer.Character
- --Fake event to make stuff like Mouse.KeyDown work
- local Disconnect_Function = function(this)
- this[1].Functions[this[2]] = nil
- end
- local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
- local FakeEvent_Metatable = {__index={
- Connect = function(this,f)
- local i = tostring(math.random(0,10000))
- while this.Functions[i] do
- i = tostring(math.random(0,10000))
- end
- this.Functions[i] = f
- return setmetatable({this,i},Disconnect_Metatable)
- end
- }}
- FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
- local function fakeEvent()
- return setmetatable({Functions={}},FakeEvent_Metatable)
- end
- --Creating fake input objects with fake variables
- local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- FakeMouse.keyUp = FakeMouse.KeyUp
- FakeMouse.keyDown = FakeMouse.KeyDown
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function TriggerEvent(self,ev,...)
- for _,f in pairs(self[ev].Functions) do
- f(...)
- end
- end
- FakeMouse.TriggerEvent = TriggerEvent
- UIS.TriggerEvent = TriggerEvent
- --Client communication
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=RealPlayer then return end
- FakeMouse.Target = io.Target
- FakeMouse.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
- local Mouse = owner:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,RobloxHandled)
- if RobloxHandled then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data every second frame, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- local HB = game:GetService("RunService").Heartbeat
- while true do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- --Wait 2 frames
- for i=1,2 do
- HB:Wait()
- end
- end]==],script)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local RealGame = game
- --Metatable for fake service
- local FakeService_Metatable = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then
- return typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
- return setmetatable(t,FakeService_Metatable)
- end
- --Fake game object
- local FakeGame = {
- GetService = function(self,s)
- return rawget(self,s) or RealGame:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = RealGame:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- }
- rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
- FakeGame.service = FakeGame.GetService
- FakeService(FakeGame,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = FakeGame,FakeGame.Players.LocalPlayer
- end
- --[[
- TODO:
- GUI
- MAKE LESS LAGGY
- REMOVE UNNEEDED STUFF
- IF CLOSE TO TARGET GRAPPLE PLACE THEN LATCH ONTO
- MAKE TITANS, TITAN SHIFT, AOT MAP
- VELOCITY CHECKS
- ]]
- --- shortcuts
- v3 = Vector3.new
- cn = CFrame.new
- ca2 = CFrame.Angles
- mceil = math.ceil mc = mceil
- mran = math.random rn=mran
- mrad = math.rad rd=mrad
- mdeg = math.deg dg=mdeg
- mabs = math.abs abs=mabs
- ud = UDim2.new
- ca = function(x,y,z) return ca2(mrad(x),mrad(y),mrad(z)) end
- mran2 = function(a,b) return mran(a*1000,b*1000)/1000 end
- bn = BrickColor.new bc=bn
- c3 = Color3.new
- deb = game:GetService("Debris")
- -----
- Player = game:service("Players").LocalPlayer
- Char = Player.Character
- Torso = Char.Torso
- Head = Char.Head
- Humanoid = Char.Humanoid
- RootPart = Char.HumanoidRootPart
- Root = RootPart.RootJoint
- script.Name = "L3dmg"
- LA=Char["Left Arm"]
- RA=Char["Right Arm"]
- LL=Char["Left Leg"]
- RL=Char["Right Leg"]
- LAM=Torso["Left Shoulder"]
- RAM=Torso["Right Shoulder"]
- LLM=Torso["Left Hip"]
- RLM=Torso["Right Hip"]
- Neck=Torso.Neck
- Neck.C0=cn(0,1.5,0)
- Neck.C1=cn(0,0,0)
- pcall(function() Char["Pack"]:Destroy() end)
- pcall(function() Player.PlayerGui[script.Name]:Destroy() end)
- pcall(function() Char[script.Name]:Destroy() end)
- pcall(function() Char.Block:Destroy() end)
- --pcall(function() Char.Animate:Destroy() end)
- as = {}
- so = {"Block","QuickSlash","Slash1","Slash2","Hit","Shoot","Footstep1","Footstep2","Footstep3","Disconnect"}
- as.Cone = "1033714"
- as.Bevel = "rbxasset://fonts/leftarm.mesh"
- as.Block = "rbxasset://sounds\\metal.ogg"
- as.QuickSlash = "161006221" -- quick succession
- as.Slash1 = "161006195" -- high pitched
- as.Slash2 = "161006212" -- low pitched
- as.Hit = "10209583"
- as.Shoot = "130849509"
- as.Footstep1 = "142548001"
- as.Footstep2 = "142548009"
- as.Footstep3 = "142548015"
- as.Disconnect = "10209268"
- as.Draw = "130785405"
- as.Somersault = "161006221"
- as.HealthBar = "35238053" -- decal
- as.Wedge = "146643893" -- decal
- for i,v in pairs(as) do
- if type(tonumber(v:sub(1,3)))=="number" then
- as[i]="http://www.roblox.com/asset/?id="..v
- game:GetService("ContentProvider"):Preload(as[i])
- end
- end
- Slashes = {as.Slash1,as.Slash2}
- iNew=function(tab)
- local v=Instance.new(tab[1])
- for Ind,Val in pairs(tab) do
- if Ind~=1 and Ind~=2 then
- v[Ind] = Val
- end
- end
- v.Parent=tab[2]==0 and LastMade or tab[2]
- LastMade=v
- return v
- end
- iPart=function(tab)
- local v=Instance.new(tab.type or "Part")
- if tab.type~="CornerWedgePart" then v.formFactor="Custom" end
- v.CanCollide=false
- v.TopSurface=10 v.BottomSurface=10 v.RightSurface=10 v.LeftSurface=10 v.FrontSurface=10 v.BackSurface=10
- v.Size=v3(tab[2],tab[3],tab[4])
- --v.Material="SmoothPlastic"
- if tab.co then v.BrickColor=bn(tab.co) end
- if tab.tr then v.Transparency=tab.tr end
- if tab.rf then v.Reflectance=tab.rf end
- if tab.cf then v.CFrame=tab.cf end
- if tab.an then v.Anchored=tab.an end
- if tab.mt then v.Material=tab.mt end
- if tab.ca then v.CanCollide=tab.ca end
- v.Parent=tab[1]
- LastMade=v
- return v
- end
- function Raycast(Pos,Dir,Dist,tab)
- return workspace:FindPartOnRay(Ray.new(Pos, Dir.unit *Dist),tab)
- end
- Block=iNew{"NumberValue",Char,Name="Block",Value=0}
- Root.C0=cn(0,0,0)
- Root.C1=cn(0,0,0)
- for _,mesh in pairs(Char:GetChildren()) do if mesh:IsA("CharacterMesh") then mesh:Destroy() end end
- for _,force in pairs(Torso:GetChildren()) do if force:IsA("BodyForce") or force:IsA("BodyGyro") or force:IsA("RocketPropulsion") then force:Destroy() end end
- function GetWeld(weld)
- if not weld:FindFirstChild("Angle") then
- local a = Instance.new("Vector3Value", weld)
- a.Name = "Angle"
- local x,y,z=weld.C0:toEulerAnglesXYZ()
- a.Value=v3(mdeg(x),mdeg(y),mdeg(z))
- end
- return weld.C0.p,weld.Angle.Value
- end
- function ClearWeld(weld)
- if weld:FindFirstChild"Angle" then
- weld.Angle:Remove()
- end
- end
- function SetWeld(weld,CC,i, loops, origpos,origangle, nextpos,nextangle,smooth)
- local CO="C"..CC
- smooth = smooth or 1
- if not weld:FindFirstChild("Angle") then
- local a = Instance.new("Vector3Value", weld)
- a.Name = "Angle"
- local x,y,z=weld.C0:toEulerAnglesXYZ()
- a.Value=v3(mdeg(x),mdeg(y),mdeg(z))
- end
- local perc
- if smooth == 1 then
- perc = math.sin((math.pi/2)/loops*i)
- else
- perc = i/loops
- end
- local tox,toy,toz = 0,0,0
- if origangle.x > nextangle.x then
- tox = -mabs(origangle.x - nextangle.x) *perc
- else
- tox = mabs(origangle.x - nextangle.x) *perc
- end
- if origangle.y > nextangle.y then
- toy = -mabs(origangle.y - nextangle.y) *perc
- else
- toy = mabs(origangle.y - nextangle.y) *perc
- end
- if origangle.z > nextangle.z then
- toz = -mabs(origangle.z - nextangle.z) *perc
- else
- toz = mabs(origangle.z - nextangle.z) *perc
- end
- local tox2,toy2,toz2 = 0,0,0
- if origpos.x > nextpos.x then
- tox2 = -mabs(origpos.x - nextpos.x) *perc
- else
- tox2 = mabs(origpos.x - nextpos.x) *perc
- end
- if origpos.y > nextpos.y then
- toy2 = -mabs(origpos.y - nextpos.y) *perc
- else
- toy2 = mabs(origpos.y - nextpos.y) *perc
- end
- if origpos.z > nextpos.z then
- toz2 = -mabs(origpos.z - nextpos.z) *perc
- else
- toz2 = mabs(origpos.z - nextpos.z) *perc
- end
- weld.Angle.Value = v3(origangle.x + tox,origangle.y + toy,origangle.z + toz)
- weld[CO] = cn(origpos.x + tox2,origpos.y + toy2,origpos.z + toz2)*ca(origangle.x + tox,origangle.y + toy,origangle.z + toz)
- end
- function PlaySound(sound,pitch,volume,parent)
- local newSound = iNew{"Sound",parent or Torso,Pitch=pitch,Volume=volume,Name=sound,SoundId=sound}
- newSound:Play()
- deb:AddItem(newSound,6)
- return newSound
- end
- function MeshEffect(par,cf,x,y,z,inc,col,sha,adj)
- local adj = adj or cn(0,0,0)
- local mp=iPart{par,1,1,1,co=col,tr=0.3,ca=false,an=true} mp.CFrame=cf mp.Name="unray"
- local ms
- if sha:sub(1,4)=="http" then
- ms=iNew{"SpecialMesh",mp,MeshId=sha}
- elseif sha=="Block" then
- ms=iNew{"BlockMesh",mp}
- elseif sha=="Cylinder" then
- ms=iNew{"CylinderMesh",mp}
- elseif sha=="Head" or sha=="Sphere" then
- ms=iNew{"SpecialMesh",mp,MeshType=sha}
- end
- deb:AddItem(mp,0.7)
- Spawn(function()
- for i=0,1,inc do
- mp.Transparency=0.3+(1*i)
- mp.CFrame=mp.CFrame*adj
- ms.Scale=v3(x,y,z)*(0.3+(1*i))
- if i>=1 or mp.Transparency >= 1 then mp:Destroy() end
- wait(0)
- end
- end)
- end
- Dmg=false
- Dmgv={12,18}
- HitDebounce={}
- Debounce = 0.4
- CritChance = 5
- Sharpness = 1
- Gas = 1
- Damage=function(Hum,Mult)
- if not Hum.Parent:findFirstChild("Torso") then return end
- local HName = Hum.Parent.Name
- if HitDebounce[HName] and HitDebounce[HName]>tick() then return end
- HitDebounce[HName] = tick()+Debounce
- local Dealt = mceil(((mran(Dmgv[1],Dmgv[2])+(Torso.Velocity.magnitude/4))*Sharpness)*Mult)
- local col = ""
- local Crit = false
- local RNG = mran(1,100)
- if RNG<=CritChance then Crit=true Dealt=Dealt*1.75 end
- if Hum.Parent:findFirstChild("Block") and Hum.Parent.Block.Value>0 then
- Hum.Parent.Block.Value=Hum.Parent.Block.Value-1
- col="Bright blue"
- PlaySound(as.Block,1,1,Torso)
- else
- Hum:TakeDamage(Dealt)
- col=not Crit and "Bright red" or "Really red"
- PlaySound(as.Hit,1,1,Torso)
- end
- Sharpness = Sharpness - 0.02
- local dmgTxt = iNew{"TextLabel",Gui,Name="dmgText",BackgroundTransparency=1,TextStrokeTransparency=0,Rotation=mran(-35,35)}
- if col == "Bright blue" then
- dmgTxt.Text = "Block!"
- elseif col == "Bright red" then
- dmgTxt.Text = Dealt.."!"
- elseif col == "Really red" then
- dmgTxt.Text = Dealt.."!!!"
- end
- dmgTxt.TextColor3 = bn(col).Color
- dmgTxt.TextStrokeColor3 = col == "Really red" and bn("Really red").Color or bn("White").Color
- dmgTxt.FontSize = col == "Bright blue" and "Size24" or col == "Bright red" and "Size36" or col == "Really red" and "Size48"
- dmgTxt.Position = ud(mran(4,6)/10,0,mran(40,60)/100,0)
- dmgTxt:TweenPosition(ud(dmgTxt.Position.X.Scale,0,dmgTxt.Position.Y.Scale,-250),"Out","Quad",1.5,false)
- deb:AddItem(dmgTxt,1.5)
- end
- -- weapon
- Pack = iNew{"Model",script,Name="PackCS"}
- p=Pack
- -- blade func
- --belt
- belt = iPart{p,2.1,0.2,1.05,co="Black"}
- iNew{"Weld",p,Part0=Torso,Part1=belt,C0=cn(0,-0.65,0)}
- --[[bp = iPart{p,0.4,0.2,1,co="Dark stone grey"} -- idk why i do this with the unneccessary details :Q
- iNew{"Weld",p,Part0=belt,Part1=bp,C0=cn(0,0,-1.05/2)}
- iNew{"BlockMesh",bp,Scale=v3(1,1,0.01)}
- bp = iPart{p,1,1,1,co="Black"}
- iNew{"Weld",p,Part0=belt,Part1=bp,C0=cn(0,0,-1.06/2)}
- iNew{"BlockMesh",bp,Scale=v3(0.35,0.15,0.01)}
- bp = iPart{p,0.2,0.2,1,co="Dark stone grey"}
- iNew{"Weld",p,Part0=belt,Part1=bp,C0=cn(0.425,0,-1.05/2)}
- iNew{"BlockMesh",bp,Scale=v3(1,1,0.01)}
- bp = iPart{p,1,1,1,co="Black"}
- iNew{"Weld",p,Part0=belt,Part1=bp,C0=cn(0.425,0,-1.06/2)}
- iNew{"BlockMesh",bp,Scale=v3(0.15,0.15,0.01)}
- bp = iPart{p,0.2,0.2,1,co="Dark stone grey"}
- iNew{"Weld",p,Part0=belt,Part1=bp,C0=cn(-0.425,0,-1.05/2)}
- iNew{"BlockMesh",bp,Scale=v3(1,1,0.01)}
- bp = iPart{p,1,1,1,co="Black"}
- iNew{"Weld",p,Part0=belt,Part1=bp,C0=cn(-0.425,0,-1.06/2)}
- iNew{"BlockMesh",bp,Scale=v3(0.15,0.15,0.01)}]]
- qBarrel = iPart{p,0.3,1.5,0.3}
- iNew{"Weld",p,Part0=belt,Part1=qBarrel,C0=cn(-1.15,0.1,0)*ca(100,0,0)}
- iNew{"CylinderMesh",qBarrel}
- bb = iPart{p,0.3,1.5,0.3}
- iNew{"Weld",p,Part0=qBarrel,Part1=bb,C0=cn(0,0,0.15)}
- qbb = iPart{p,0.2,1,0.2,co="Really black"}
- iNew{"Weld",p,Part0=qBarrel,Part1=qbb,C0=cn(0,-0.75,0)}
- iNew{"CylinderMesh",qbb,Scale=v3(1,0.01,1)}
- eBarrel = iPart{p,0.3,1.5,0.3}
- iNew{"Weld",p,Part0=belt,Part1=eBarrel,C0=cn(1.15,0.1,0)*ca(100,0,0)}
- iNew{"CylinderMesh",eBarrel}
- bb = iPart{p,0.3,1.5,0.3}
- iNew{"Weld",p,Part0=eBarrel,Part1=bb,C0=cn(0,0,0.15)}
- ebb = iPart{p,0.2,1,0.2,co="Really black"}
- iNew{"Weld",p,Part0=eBarrel,Part1=ebb,C0=cn(0,-0.75,0)}
- iNew{"CylinderMesh",ebb,Scale=v3(1,0.01,1)}
- for i,v in pairs(Torso:children()) do
- if v:IsA("Sound") then
- v:Destroy()
- end
- end
- for i,v in pairs(Head:children()) do
- if v:IsA("Sound") then
- v:Destroy()
- end
- end
- Force = iNew{"BodyForce",Torso} -- force
- keys={}
- WalkMode = "Walk"
- CanGrapple = true
- qProp=nil
- qPart=nil
- qRope=nil
- qOffset=nil
- qHit = nil
- qLastGrapple = tick()
- eProp=nil
- ePart=nil
- eRope=nil
- eOffset=nil
- eHit=nil
- eLastGrapple = tick()
- qePart=nil
- qeProp=nil
- function GrappleStance()
- --Humanoid.PlatformStand=true
- --SetWeld(LLW,0,1,1,v3(0,0,0),v3(0,0,0),v3(-0.5,-1,-1),v3(-25,12,-12),0)
- --SetWeld(RLW,0,1,1,v3(0,0,0),v3(0,0,0),v3(0.5,-1,-1),v3(-25,-12,12),0)
- end
- MaxSpeed = 300
- ThrustP = 5
- MaxThrust1 = 16000
- MaxThrust2 = 21000
- function AddRP(target,name,maxThrust)
- local newProp = iNew{"RocketPropulsion",RootPart}
- newProp.Name = target.Name:gsub("Part","Prop")
- newProp.Target = target
- newProp.CartoonFactor = 0.5
- newProp.MaxSpeed = MaxSpeed
- newProp.MaxThrust = maxThrust
- newProp.MaxTorque = v3(1/0,1/0,1/0)
- newProp.TurnD = 0
- newProp.TurnP = 0
- newProp.ThrustD = 0.001
- newProp.ThrustP = ThrustP
- newProp.TargetRadius = 8
- newProp.ReachedTarget:connect(function()
- end)
- return newProp
- end
- function UpdatePropulsions()
- for i,v in pairs(RootPart:GetChildren()) do
- if v:IsA("RocketPropulsion") then
- v.MaxSpeed = MaxSpeed
- v.ThrustP = ThrustP
- end
- end
- end
- function Grapple(side,to,spd)
- if not CanGrapple then return end
- PlaySound(as.Shoot,mran2(4.5,5.5),1,Torso)
- local MouseCF = to
- local hit,hitpos
- local Drop = 0.1
- if side == "q" then
- if qPart then qPart:Destroy() qPart=nil end
- if qProp then qProp:Destroy() qProp=nil end
- qPart = iPart{Pack,1,2,1,an=true,co="Black",cf=cn(qbb.CFrame.p,MouseCF.p)*ca(-90,0,0)} qPart.Name = "qPart"
- iNew{"SpecialMesh",qPart,MeshId=as.Cone,Scale=v3(0.4,2,0.4)}
- qRope = iPart{qPart,1,1,1,an=true,co="Black"}
- iNew{"CylinderMesh",qRope}
- for i=1,10000 do
- if not qPart then return end
- hit,hitpos = Raycast(qPart.Position,qPart.Position - (qPart.CFrame *cn(0,-1,0)).p,spd,Char)
- qPart.CFrame=qPart.CFrame*cn(0,spd,0)*ca(-Drop,0,0)
- if hit and hitpos and hit.Name~="unray" then
- PlaySound(as.Block,1,1,Torso)
- local pa,pb,pc=qPart.CFrame:toEulerAnglesXYZ()
- qPart.CFrame=cn(hitpos)*ca2(pa,pb,pc)
- qHit = hit
- qOffset = hit.CFrame:toObjectSpace(qPart.CFrame)
- if ePart and eHit then
- if qePart then qePart:Destroy() qePart=nil end
- if eProp then eProp:Destroy() eProp=nil end
- if qProp then qProp:Destroy() qProp=nil end
- if qeProp then qeProp:Destroy() qeProp=nil end
- qePart=iPart{Pack,1,1,1,tr=1,an=true,cf=cn(qPart.CFrame.p:Lerp(ePart.CFrame.p,0.5))}
- qeProp = AddRP(qePart,"qeProp",MaxThrust2)
- qeProp:Fire()
- elseif (ePart or not ePart) and not eHit then -- fixed glitch where trying to grapple and firing one
- qProp=AddRP(qPart,"qProp",MaxThrust1)
- qProp:Fire()
- end
- end
- if hit and hitpos then break end
- wait(0)
- end
- elseif side == "e" then
- if ePart then ePart:Destroy() ePart=nil end
- if eProp then eProp:Destroy() eProp=nil end
- ePart = iPart{Pack,1,2,1,an=true,co="Black",cf=cn(ebb.CFrame.p,MouseCF.p)*ca(-90,0,0)} ePart.Name = "ePart"
- iNew{"SpecialMesh",ePart,MeshId=as.Cone,Scale=v3(0.4,2,0.4)}
- eRope = iPart{ePart,1,1,1,an=true,co="Black"}
- iNew{"CylinderMesh",eRope}
- for i=1,10000 do
- if not ePart then return end
- hit,hitpos = Raycast(ePart.Position,ePart.Position - (ePart.CFrame *cn(0,-1,0)).p,spd,Char)
- ePart.CFrame=ePart.CFrame*cn(0,spd,0)*ca(-Drop,0,0)
- if hit and hitpos and hit.Name~="unray" then
- PlaySound(as.Block,1,1,Torso,Torso)
- local pa,pb,pc=ePart.CFrame:toEulerAnglesXYZ()
- ePart.CFrame=cn(hitpos)*ca2(pa,pb,pc)
- eHit = hit
- eOffset = hit.CFrame:toObjectSpace(ePart.CFrame)
- if qPart and qHit then
- if qePart then qePart:Destroy() qePart=nil end
- if eProp then eProp:Destroy() eProp=nil end
- if qProp then qProp:Destroy() qProp=nil end
- if qeProp then qeProp:Destroy() qeProp=nil end
- qePart=iPart{Pack,1,1,1,tr=1,an=true,cf=cn(ePart.CFrame.p:Lerp(qPart.CFrame.p,0.5))}
- qeProp = AddRP(qePart,"qeProp",MaxThrust2)
- qeProp:Fire()
- elseif (qPart or not qPart) and not qHit then
- eProp=AddRP(ePart,"eProp",MaxThrust1)
- eProp:Fire()
- end
- end
- if hit and hitpos then break end
- wait(0)
- end
- end
- Humanoid.Jump=true
- Grappling=true
- --ReturnPose()
- --GrappleStance()
- end
- do
- Mouse=Player:GetMouse()
- Mouse.KeyDown:connect(function(key)
- keys[key]=true
- if Mouse and Mouse.Hit then
- -- Grapple
- if key == "q" then
- if not keys["g"] then
- Grapple("q",Mouse.Hit,18)
- end
- end
- if key == "e" then
- if not keys["g"] then
- Grapple("e",Mouse.Hit,18)
- end
- end
- -- Jump
- if key == " " then
- Humanoid.PlatformStand=false
- Grappling=false
- if qPart then qPart:Destroy() qPart=nil qRope=nil qHit=nil end
- if ePart then ePart:Destroy() ePart=nil eRope=nil eHit=nil end
- if qePart then qePart:Destroy() qePart=nil end
- if qProp then qProp:Destroy() qProp=nil end
- if eProp then eProp:Destroy() eProp=nil end
- if qeProp then qeProp:Destroy() qeProp=nil end
- end
- end
- end)
- Mouse.KeyUp:connect(function(key)
- keys[key]=false
- if key == "q" then
- if keys["g"] then return end
- if not keys["e"] then Grappling=false end
- if qPart then qPart:Destroy() qPart=nil qRope = nil qHit=nil end
- if qePart then qePart:Destroy() qePart=nil end
- if qProp then qProp:Destroy() qProp=nil end
- if qeProp then qeProp:Destroy() qeProp=nil end
- if keys["e"] then
- if ePart and not eProp and eHit then
- eProp=AddRP(ePart,"eProp",MaxThrust1)
- eProp:Fire()
- end
- end
- end
- if key == "e" then
- if keys["g"] then return end
- if not keys["q"] then Grappling=false end
- if ePart then ePart:Destroy() ePart=nil eRope = nil eHit=nil end
- if qePart then qePart:Destroy() qePart=nil end
- if eProp then eProp:Destroy() eProp=nil end
- if qeProp then qeProp:Destroy() qeProp=nil end
- if keys["q"] then
- if qPart and not qProp and qHit then
- qProp=AddRP(qPart,"qProp",MaxThrust1)
- qProp:Fire()
- end
- end
- end
- if key == "g" then
- if keys["q"] or keys["e"] then return end
- Grappling=false
- if qPart then qPart:Destroy() qPart=nil qRope = nil qHit=nil end
- if ePart then ePart:Destroy() ePart=nil eRope = nil eHit=nil end
- if qePart then qePart:Destroy() qePart=nil end
- if qProp then qProp:Destroy() qProp=nil end
- if eProp then eProp:Destroy() eProp=nil end
- if qeProp then qeProp:Destroy() qeProp=nil end
- end
- end)
- end
- Anim = ""
- Footsteps = {as.Footstep1,as.Footstep2,as.Footstep3}
- Grappling = false
- ASpeed = 9
- Attack = 1
- CurrentBlades = {nil,nil}
- Humanoid.Died:connect(function() Pack:Destroy() script:Destroy() end)
- hpart = iPart{p,0.8,0.4,0.8}
- iNew{"Weld",p,Part0=belt,Part1=hpart,C0=cn(0,-0.1,0.9)*ca(15,0,0)}
- iNew{"CylinderMesh",hpart}
- hp2 = iPart{p,0.3,0.2,0.3}
- iNew{"Weld",p,Part0=hpart,Part1=hp2,C0=cn(0,0.1,0.5)}
- iNew{"BlockMesh",hp2,Scale=v3(0.5,0.5,1)}
- -- Main loop
- Count = 0
- game:GetService("RunService").RenderStepped:connect(function()
- Count = Count + 1
- if Pack.Parent then
- -- Grapple sticking
- if qOffset and qHit and qPart then
- qPart.CFrame = qHit.CFrame * qOffset
- end
- if eOffset and eHit and ePart then
- ePart.CFrame = eHit.CFrame * eOffset
- end
- if qPart and ePart and qePart then
- qePart.CFrame = cn(qPart.CFrame.p,ePart.CFrame.p)*cn(0,0,-(qPart.CFrame.p-ePart.CFrame.p).magnitude/2)
- end
- -- Rope
- if qRope then
- qRope.Mesh.Scale = v3(0.25,(qbb.CFrame.p-qPart.CFrame.p).magnitude,0.25)
- qRope.CFrame = cn(qbb.CFrame.p,qPart.CFrame.p)*ca(-90,0,0)*cn(0,(qbb.CFrame.p-qPart.CFrame.p).magnitude/2,0)
- end
- if eRope then
- eRope.Mesh.Scale = v3(0.25,(ebb.CFrame.p-ePart.CFrame.p).magnitude,0.25)
- eRope.CFrame = cn(ebb.CFrame.p,ePart.CFrame.p)*ca(-90,0,0)*cn(0,(ebb.CFrame.p-ePart.CFrame.p).magnitude/2,0)
- end
- -- Mouse gyro, force, and boosting
- if (qHit and qProp) or (eHit and eProp) or (qePart and qeProp) then
- if qProp then qProp:Fire() end
- if eProp then eProp:Fire() end
- if qeProp then qeProp:Fire() end
- RootPart.CFrame = cn(RootPart.CFrame.p,Mouse.Hit.p)
- if keys["4"] and Gas>0 then
- if Count%10==0 then
- iNew{"Smoke",hp2,Color=bc("Medium stone grey").Color,Opacity=0.5,RiseVelocity=7,Size=2}
- deb:AddItem(LastMade,1)
- Gas = Gas - 0.005
- end
- Force.force=RootPart.CFrame.lookVector*3000
- MaxSpeed = 400
- ThrustP = 5
- UpdatePropulsions()
- elseif not keys["4"] then
- Force.force=RootPart.CFrame.lookVector*0
- MaxSpeed = 300
- ThrustP = 5
- UpdatePropulsions()
- end
- elseif not qProp and not eProp and not qeProp then
- if not Anim == "Jump" and not Anim == "Flip Slash" then
- Force.force = v3(0,0,0)
- end
- end
- -- Walkspeed
- if WalkMode == "Walk" and Anim == "" then
- Humanoid.WalkSpeed = 10
- elseif WalkMode == "Run" and Anim == "" then
- Humanoid.WalkSpeed = 28
- end
- -- Sharpness and Gas
- if Sharpness <= 0 then
- Sharpness = 0
- if CurrentBlades[1] and CurrentBlades[2] then
- PlaySound(as.Disconnect,1,1,Torso)
- CurrentBlades[1].Part0 = nil
- CurrentBlades[1].Part1.CanCollide = true
- CurrentBlades[1] = nil
- CurrentBlades[2].Part0 = nil
- CurrentBlades[2].Part1.CanCollide = true
- CurrentBlades[2] = nil
- end
- end
- if Gas <= 0 then
- Gas = 0
- end
- end
- end)
- --[[
- -- props (only really useful for when there is no map)
- for _,prop in pairs(workspace:GetChildren()) do
- if prop.Name=="prop" and prop:IsA("BasePart") then
- prop:Destroy()
- end
- end
- tp=iPart{workspace,80,5,700,cf=cn(0,200,600)*ca(15,0,0),an=true,ca=true} tp.Name="prop"
- for i=1,10 do
- local sizeY = mran(25,250)
- tp=iPart{workspace,15,sizeY,15,cf=cn(mran(-300,300),sizeY/2.5,mran(-300,300))*ca(mran(-15,15),0,mran(-15,15)),an=true,ca=true} tp.Name="prop"
- end
- for i=1,100 do
- local tp = iPart{workspace,i==100 and 80 or mran(40,60),6,i==100 and 80 or mran(15,30),an=true,ca=true,co=i==100 and "Black" or "Medium stone grey",
- cf=cn(mran(-150,150),250+(i*mran(80,120)),mran(-100,100))*ca(mran(-15,15),mran(-360,360),mran(-15,15))
- }
- tp.Name="prop"
- end]]
Add Comment
Please, Sign In to add comment