carlosname

Untitled

Mar 18th, 2021 (edited)
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.36 KB | None | 0 0
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6. print("FE Compatibility code V2 by Mokiros")
  7. local RealPlayer = RealPlayer
  8. script.Parent = RealPlayer.Character
  9.  
  10. --Fake event to make stuff like Mouse.KeyDown work
  11. local Disconnect_Function = function(this)
  12. this[1].Functions[this[2]] = nil
  13. end
  14. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  15. local FakeEvent_Metatable = {__index={
  16. Connect = function(this,f)
  17. local i = tostring(math.random(0,10000))
  18. while this.Functions[i] do
  19. i = tostring(math.random(0,10000))
  20. end
  21. this.Functions[i] = f
  22. return setmetatable({this,i},Disconnect_Metatable)
  23. end
  24. }}
  25. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  26. local function fakeEvent()
  27. return setmetatable({Functions={}},FakeEvent_Metatable)
  28. end
  29.  
  30. --Creating fake input objects with fake variables
  31. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  32. FakeMouse.keyUp = FakeMouse.KeyUp
  33. FakeMouse.keyDown = FakeMouse.KeyDown
  34. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  35. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  36. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  37. end}
  38. --Merged 2 functions into one by checking amount of arguments
  39. CAS.UnbindAction = CAS.BindAction
  40.  
  41. --This function will trigger the events that have been :Connect()'ed
  42. local function TriggerEvent(self,ev,...)
  43. for _,f in pairs(self[ev].Functions) do
  44. f(...)
  45. end
  46. end
  47. FakeMouse.TriggerEvent = TriggerEvent
  48. UIS.TriggerEvent = TriggerEvent
  49.  
  50. --Client communication
  51. local Event = Instance.new("RemoteEvent")
  52. Event.Name = "UserInput_Event"
  53. Event.OnServerEvent:Connect(function(plr,io)
  54. if plr~=RealPlayer then return end
  55. FakeMouse.Target = io.Target
  56. FakeMouse.Hit = io.Hit
  57. if not io.isMouse then
  58. local b = io.UserInputState == Enum.UserInputState.Begin
  59. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  60. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  61. end
  62. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  63. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  64. end
  65. for _,t in pairs(CAS.Actions) do
  66. for _,k in pairs(t.Keys) do
  67. if k==io.KeyCode then
  68. t.Function(t.Name,io.UserInputState,io)
  69. end
  70. end
  71. end
  72. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  73. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  74. end
  75. end)
  76. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  77. local Mouse = owner:GetMouse()
  78. local UIS = game:GetService("UserInputService")
  79. local input = function(io,RobloxHandled)
  80. if RobloxHandled then return end
  81. --Since InputObject is a client-side instance, we create and pass table instead
  82. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  83. end
  84. UIS.InputBegan:Connect(input)
  85. UIS.InputEnded:Connect(input)
  86. local h,t
  87. --Give the server mouse data every second frame, but only if the values changed
  88. --If player is not moving their mouse, client won't fire events
  89. local HB = game:GetService("RunService").Heartbeat
  90. while true do
  91. if h~=Mouse.Hit or t~=Mouse.Target then
  92. h,t=Mouse.Hit,Mouse.Target
  93. Event:FireServer({isMouse=true,Target=t,Hit=h})
  94. end
  95. --Wait 2 frames
  96. for i=1,2 do
  97. HB:Wait()
  98. end
  99. end]==],script)
  100.  
  101. ----Sandboxed game object that allows the usage of client-side methods and services
  102. --Real game object
  103. local RealGame = game
  104.  
  105. --Metatable for fake service
  106. local FakeService_Metatable = {
  107. __index = function(self,k)
  108. local s = rawget(self,"_RealService")
  109. if s then
  110. return typeof(s[k])=="function"
  111. and function(_,...)return s[k](s,...)end or s[k]
  112. end
  113. end,
  114. __newindex = function(self,k,v)
  115. local s = rawget(self,"_RealService")
  116. if s then s[k]=v end
  117. end
  118. }
  119. local function FakeService(t,RealService)
  120. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  121. return setmetatable(t,FakeService_Metatable)
  122. end
  123.  
  124. --Fake game object
  125. local FakeGame = {
  126. GetService = function(self,s)
  127. return rawget(self,s) or RealGame:GetService(s)
  128. end,
  129. Players = FakeService({
  130. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  131. },"Players"),
  132. UserInputService = FakeService(UIS,"UserInputService"),
  133. ContextActionService = FakeService(CAS,"ContextActionService"),
  134. RunService = FakeService({
  135. _btrs = {},
  136. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  137. BindToRenderStep = function(self,name,_,fun)
  138. self._btrs[name] = self.Heartbeat:Connect(fun)
  139. end,
  140. UnbindFromRenderStep = function(self,name)
  141. self._btrs[name]:Disconnect()
  142. end,
  143. },"RunService")
  144. }
  145. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  146. FakeGame.service = FakeGame.GetService
  147. FakeService(FakeGame,game)
  148. --Changing owner to fake player object to support owner:GetMouse()
  149. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  150. end
  151.  
  152. --[[
  153. TODO:
  154. GUI
  155. MAKE LESS LAGGY
  156. REMOVE UNNEEDED STUFF
  157. IF CLOSE TO TARGET GRAPPLE PLACE THEN LATCH ONTO
  158. MAKE TITANS, TITAN SHIFT, AOT MAP
  159. VELOCITY CHECKS
  160. ]]
  161.  
  162. --- shortcuts
  163. v3 = Vector3.new
  164. cn = CFrame.new
  165. ca2 = CFrame.Angles
  166. mceil = math.ceil mc = mceil
  167. mran = math.random rn=mran
  168. mrad = math.rad rd=mrad
  169. mdeg = math.deg dg=mdeg
  170. mabs = math.abs abs=mabs
  171. ud = UDim2.new
  172. ca = function(x,y,z) return ca2(mrad(x),mrad(y),mrad(z)) end
  173. mran2 = function(a,b) return mran(a*1000,b*1000)/1000 end
  174. bn = BrickColor.new bc=bn
  175. c3 = Color3.new
  176. deb = game:GetService("Debris")
  177. -----
  178. Player = game:service("Players").LocalPlayer
  179. Char = Player.Character
  180. Torso = Char.Torso
  181. Head = Char.Head
  182. Humanoid = Char.Humanoid
  183. RootPart = Char.HumanoidRootPart
  184. Root = RootPart.RootJoint
  185. script.Name = "L3dmg"
  186. LA=Char["Left Arm"]
  187. RA=Char["Right Arm"]
  188. LL=Char["Left Leg"]
  189. RL=Char["Right Leg"]
  190. LAM=Torso["Left Shoulder"]
  191. RAM=Torso["Right Shoulder"]
  192. LLM=Torso["Left Hip"]
  193. RLM=Torso["Right Hip"]
  194. Neck=Torso.Neck
  195. Neck.C0=cn(0,1.5,0)
  196. Neck.C1=cn(0,0,0)
  197.  
  198.  
  199.  
  200. pcall(function() Char["Pack"]:Destroy() end)
  201. pcall(function() Player.PlayerGui[script.Name]:Destroy() end)
  202. pcall(function() Char[script.Name]:Destroy() end)
  203. pcall(function() Char.Block:Destroy() end)
  204. --pcall(function() Char.Animate:Destroy() end)
  205.  
  206.  
  207. as = {}
  208. so = {"Block","QuickSlash","Slash1","Slash2","Hit","Shoot","Footstep1","Footstep2","Footstep3","Disconnect"}
  209. as.Cone = "1033714"
  210. as.Bevel = "rbxasset://fonts/leftarm.mesh"
  211. as.Block = "rbxasset://sounds\\metal.ogg"
  212. as.QuickSlash = "161006221" -- quick succession
  213. as.Slash1 = "161006195" -- high pitched
  214. as.Slash2 = "161006212" -- low pitched
  215. as.Hit = "10209583"
  216. as.Shoot = "130849509"
  217. as.Footstep1 = "142548001"
  218. as.Footstep2 = "142548009"
  219. as.Footstep3 = "142548015"
  220. as.Disconnect = "10209268"
  221. as.Draw = "130785405"
  222. as.Somersault = "161006221"
  223. as.HealthBar = "35238053" -- decal
  224. as.Wedge = "146643893" -- decal
  225.  
  226. for i,v in pairs(as) do
  227. if type(tonumber(v:sub(1,3)))=="number" then
  228. as[i]="http://www.roblox.com/asset/?id="..v
  229. game:GetService("ContentProvider"):Preload(as[i])
  230. end
  231. end
  232.  
  233. Slashes = {as.Slash1,as.Slash2}
  234.  
  235.  
  236. iNew=function(tab)
  237. local v=Instance.new(tab[1])
  238. for Ind,Val in pairs(tab) do
  239. if Ind~=1 and Ind~=2 then
  240. v[Ind] = Val
  241. end
  242. end
  243. v.Parent=tab[2]==0 and LastMade or tab[2]
  244. LastMade=v
  245. return v
  246. end
  247.  
  248. iPart=function(tab)
  249. local v=Instance.new(tab.type or "Part")
  250. if tab.type~="CornerWedgePart" then v.formFactor="Custom" end
  251. v.CanCollide=false
  252. v.TopSurface=10 v.BottomSurface=10 v.RightSurface=10 v.LeftSurface=10 v.FrontSurface=10 v.BackSurface=10
  253. v.Size=v3(tab[2],tab[3],tab[4])
  254. --v.Material="SmoothPlastic"
  255. if tab.co then v.BrickColor=bn(tab.co) end
  256. if tab.tr then v.Transparency=tab.tr end
  257. if tab.rf then v.Reflectance=tab.rf end
  258. if tab.cf then v.CFrame=tab.cf end
  259. if tab.an then v.Anchored=tab.an end
  260. if tab.mt then v.Material=tab.mt end
  261. if tab.ca then v.CanCollide=tab.ca end
  262. v.Parent=tab[1]
  263. LastMade=v
  264. return v
  265. end
  266.  
  267. function Raycast(Pos,Dir,Dist,tab)
  268. return workspace:FindPartOnRay(Ray.new(Pos, Dir.unit *Dist),tab)
  269. end
  270.  
  271. Block=iNew{"NumberValue",Char,Name="Block",Value=0}
  272.  
  273. Root.C0=cn(0,0,0)
  274. Root.C1=cn(0,0,0)
  275.  
  276. for _,mesh in pairs(Char:GetChildren()) do if mesh:IsA("CharacterMesh") then mesh:Destroy() end end
  277. for _,force in pairs(Torso:GetChildren()) do if force:IsA("BodyForce") or force:IsA("BodyGyro") or force:IsA("RocketPropulsion") then force:Destroy() end end
  278.  
  279.  
  280.  
  281. function GetWeld(weld)
  282. if not weld:FindFirstChild("Angle") then
  283. local a = Instance.new("Vector3Value", weld)
  284. a.Name = "Angle"
  285. local x,y,z=weld.C0:toEulerAnglesXYZ()
  286. a.Value=v3(mdeg(x),mdeg(y),mdeg(z))
  287. end
  288. return weld.C0.p,weld.Angle.Value
  289. end
  290.  
  291. function ClearWeld(weld)
  292. if weld:FindFirstChild"Angle" then
  293. weld.Angle:Remove()
  294. end
  295. end
  296.  
  297. function SetWeld(weld,CC,i, loops, origpos,origangle, nextpos,nextangle,smooth)
  298. local CO="C"..CC
  299. smooth = smooth or 1
  300. if not weld:FindFirstChild("Angle") then
  301. local a = Instance.new("Vector3Value", weld)
  302. a.Name = "Angle"
  303. local x,y,z=weld.C0:toEulerAnglesXYZ()
  304. a.Value=v3(mdeg(x),mdeg(y),mdeg(z))
  305. end
  306.  
  307. local perc
  308. if smooth == 1 then
  309. perc = math.sin((math.pi/2)/loops*i)
  310. else
  311. perc = i/loops
  312. end
  313.  
  314. local tox,toy,toz = 0,0,0
  315. if origangle.x > nextangle.x then
  316. tox = -mabs(origangle.x - nextangle.x) *perc
  317. else
  318. tox = mabs(origangle.x - nextangle.x) *perc
  319. end
  320. if origangle.y > nextangle.y then
  321. toy = -mabs(origangle.y - nextangle.y) *perc
  322. else
  323. toy = mabs(origangle.y - nextangle.y) *perc
  324. end
  325. if origangle.z > nextangle.z then
  326. toz = -mabs(origangle.z - nextangle.z) *perc
  327. else
  328. toz = mabs(origangle.z - nextangle.z) *perc
  329. end
  330.  
  331. local tox2,toy2,toz2 = 0,0,0
  332. if origpos.x > nextpos.x then
  333. tox2 = -mabs(origpos.x - nextpos.x) *perc
  334. else
  335. tox2 = mabs(origpos.x - nextpos.x) *perc
  336. end
  337. if origpos.y > nextpos.y then
  338. toy2 = -mabs(origpos.y - nextpos.y) *perc
  339. else
  340. toy2 = mabs(origpos.y - nextpos.y) *perc
  341. end
  342. if origpos.z > nextpos.z then
  343. toz2 = -mabs(origpos.z - nextpos.z) *perc
  344. else
  345. toz2 = mabs(origpos.z - nextpos.z) *perc
  346. end
  347. weld.Angle.Value = v3(origangle.x + tox,origangle.y + toy,origangle.z + toz)
  348. weld[CO] = cn(origpos.x + tox2,origpos.y + toy2,origpos.z + toz2)*ca(origangle.x + tox,origangle.y + toy,origangle.z + toz)
  349. end
  350.  
  351.  
  352. function PlaySound(sound,pitch,volume,parent)
  353. local newSound = iNew{"Sound",parent or Torso,Pitch=pitch,Volume=volume,Name=sound,SoundId=sound}
  354. newSound:Play()
  355. deb:AddItem(newSound,6)
  356. return newSound
  357. end
  358.  
  359. function MeshEffect(par,cf,x,y,z,inc,col,sha,adj)
  360. local adj = adj or cn(0,0,0)
  361. local mp=iPart{par,1,1,1,co=col,tr=0.3,ca=false,an=true} mp.CFrame=cf mp.Name="unray"
  362. local ms
  363. if sha:sub(1,4)=="http" then
  364. ms=iNew{"SpecialMesh",mp,MeshId=sha}
  365. elseif sha=="Block" then
  366. ms=iNew{"BlockMesh",mp}
  367. elseif sha=="Cylinder" then
  368. ms=iNew{"CylinderMesh",mp}
  369. elseif sha=="Head" or sha=="Sphere" then
  370. ms=iNew{"SpecialMesh",mp,MeshType=sha}
  371. end
  372. deb:AddItem(mp,0.7)
  373. Spawn(function()
  374. for i=0,1,inc do
  375. mp.Transparency=0.3+(1*i)
  376. mp.CFrame=mp.CFrame*adj
  377. ms.Scale=v3(x,y,z)*(0.3+(1*i))
  378. if i>=1 or mp.Transparency >= 1 then mp:Destroy() end
  379. wait(0)
  380. end
  381. end)
  382. end
  383.  
  384.  
  385. Dmg=false
  386. Dmgv={12,18}
  387. HitDebounce={}
  388. Debounce = 0.4
  389. CritChance = 5
  390. Sharpness = 1
  391. Gas = 1
  392. Damage=function(Hum,Mult)
  393. if not Hum.Parent:findFirstChild("Torso") then return end
  394. local HName = Hum.Parent.Name
  395. if HitDebounce[HName] and HitDebounce[HName]>tick() then return end
  396. HitDebounce[HName] = tick()+Debounce
  397. local Dealt = mceil(((mran(Dmgv[1],Dmgv[2])+(Torso.Velocity.magnitude/4))*Sharpness)*Mult)
  398. local col = ""
  399.  
  400. local Crit = false
  401. local RNG = mran(1,100)
  402. if RNG<=CritChance then Crit=true Dealt=Dealt*1.75 end
  403.  
  404. if Hum.Parent:findFirstChild("Block") and Hum.Parent.Block.Value>0 then
  405. Hum.Parent.Block.Value=Hum.Parent.Block.Value-1
  406. col="Bright blue"
  407. PlaySound(as.Block,1,1,Torso)
  408. else
  409.  
  410. Hum:TakeDamage(Dealt)
  411. col=not Crit and "Bright red" or "Really red"
  412. PlaySound(as.Hit,1,1,Torso)
  413. end
  414. Sharpness = Sharpness - 0.02
  415.  
  416. local dmgTxt = iNew{"TextLabel",Gui,Name="dmgText",BackgroundTransparency=1,TextStrokeTransparency=0,Rotation=mran(-35,35)}
  417.  
  418. if col == "Bright blue" then
  419. dmgTxt.Text = "Block!"
  420. elseif col == "Bright red" then
  421. dmgTxt.Text = Dealt.."!"
  422. elseif col == "Really red" then
  423. dmgTxt.Text = Dealt.."!!!"
  424. end
  425. dmgTxt.TextColor3 = bn(col).Color
  426. dmgTxt.TextStrokeColor3 = col == "Really red" and bn("Really red").Color or bn("White").Color
  427. dmgTxt.FontSize = col == "Bright blue" and "Size24" or col == "Bright red" and "Size36" or col == "Really red" and "Size48"
  428. dmgTxt.Position = ud(mran(4,6)/10,0,mran(40,60)/100,0)
  429. dmgTxt:TweenPosition(ud(dmgTxt.Position.X.Scale,0,dmgTxt.Position.Y.Scale,-250),"Out","Quad",1.5,false)
  430. deb:AddItem(dmgTxt,1.5)
  431. end
  432.  
  433.  
  434.  
  435. -- weapon
  436. Pack = iNew{"Model",script,Name="PackCS"}
  437. p=Pack
  438.  
  439.  
  440. -- blade func
  441.  
  442. --belt
  443. belt = iPart{p,2.1,0.2,1.05,co="Black"}
  444. iNew{"Weld",p,Part0=Torso,Part1=belt,C0=cn(0,-0.65,0)}
  445. --[[bp = iPart{p,0.4,0.2,1,co="Dark stone grey"} -- idk why i do this with the unneccessary details :Q
  446. iNew{"Weld",p,Part0=belt,Part1=bp,C0=cn(0,0,-1.05/2)}
  447. iNew{"BlockMesh",bp,Scale=v3(1,1,0.01)}
  448. bp = iPart{p,1,1,1,co="Black"}
  449. iNew{"Weld",p,Part0=belt,Part1=bp,C0=cn(0,0,-1.06/2)}
  450. iNew{"BlockMesh",bp,Scale=v3(0.35,0.15,0.01)}
  451. bp = iPart{p,0.2,0.2,1,co="Dark stone grey"}
  452. iNew{"Weld",p,Part0=belt,Part1=bp,C0=cn(0.425,0,-1.05/2)}
  453. iNew{"BlockMesh",bp,Scale=v3(1,1,0.01)}
  454. bp = iPart{p,1,1,1,co="Black"}
  455. iNew{"Weld",p,Part0=belt,Part1=bp,C0=cn(0.425,0,-1.06/2)}
  456. iNew{"BlockMesh",bp,Scale=v3(0.15,0.15,0.01)}
  457. bp = iPart{p,0.2,0.2,1,co="Dark stone grey"}
  458. iNew{"Weld",p,Part0=belt,Part1=bp,C0=cn(-0.425,0,-1.05/2)}
  459. iNew{"BlockMesh",bp,Scale=v3(1,1,0.01)}
  460. bp = iPart{p,1,1,1,co="Black"}
  461. iNew{"Weld",p,Part0=belt,Part1=bp,C0=cn(-0.425,0,-1.06/2)}
  462. iNew{"BlockMesh",bp,Scale=v3(0.15,0.15,0.01)}]]
  463.  
  464. qBarrel = iPart{p,0.3,1.5,0.3}
  465. iNew{"Weld",p,Part0=belt,Part1=qBarrel,C0=cn(-1.15,0.1,0)*ca(100,0,0)}
  466. iNew{"CylinderMesh",qBarrel}
  467. bb = iPart{p,0.3,1.5,0.3}
  468. iNew{"Weld",p,Part0=qBarrel,Part1=bb,C0=cn(0,0,0.15)}
  469. qbb = iPart{p,0.2,1,0.2,co="Really black"}
  470. iNew{"Weld",p,Part0=qBarrel,Part1=qbb,C0=cn(0,-0.75,0)}
  471. iNew{"CylinderMesh",qbb,Scale=v3(1,0.01,1)}
  472.  
  473. eBarrel = iPart{p,0.3,1.5,0.3}
  474. iNew{"Weld",p,Part0=belt,Part1=eBarrel,C0=cn(1.15,0.1,0)*ca(100,0,0)}
  475. iNew{"CylinderMesh",eBarrel}
  476. bb = iPart{p,0.3,1.5,0.3}
  477. iNew{"Weld",p,Part0=eBarrel,Part1=bb,C0=cn(0,0,0.15)}
  478. ebb = iPart{p,0.2,1,0.2,co="Really black"}
  479. iNew{"Weld",p,Part0=eBarrel,Part1=ebb,C0=cn(0,-0.75,0)}
  480. iNew{"CylinderMesh",ebb,Scale=v3(1,0.01,1)}
  481.  
  482.  
  483.  
  484.  
  485. for i,v in pairs(Torso:children()) do
  486. if v:IsA("Sound") then
  487. v:Destroy()
  488. end
  489. end
  490. for i,v in pairs(Head:children()) do
  491. if v:IsA("Sound") then
  492. v:Destroy()
  493. end
  494. end
  495.  
  496. Force = iNew{"BodyForce",Torso} -- force
  497. keys={}
  498.  
  499. WalkMode = "Walk"
  500.  
  501. CanGrapple = true
  502.  
  503. qProp=nil
  504. qPart=nil
  505. qRope=nil
  506. qOffset=nil
  507. qHit = nil
  508. qLastGrapple = tick()
  509.  
  510. eProp=nil
  511. ePart=nil
  512. eRope=nil
  513. eOffset=nil
  514. eHit=nil
  515. eLastGrapple = tick()
  516.  
  517. qePart=nil
  518. qeProp=nil
  519.  
  520. function GrappleStance()
  521. --Humanoid.PlatformStand=true
  522. --SetWeld(LLW,0,1,1,v3(0,0,0),v3(0,0,0),v3(-0.5,-1,-1),v3(-25,12,-12),0)
  523. --SetWeld(RLW,0,1,1,v3(0,0,0),v3(0,0,0),v3(0.5,-1,-1),v3(-25,-12,12),0)
  524. end
  525.  
  526. MaxSpeed = 300
  527. ThrustP = 5
  528. MaxThrust1 = 16000
  529. MaxThrust2 = 21000
  530. function AddRP(target,name,maxThrust)
  531. local newProp = iNew{"RocketPropulsion",RootPart}
  532. newProp.Name = target.Name:gsub("Part","Prop")
  533. newProp.Target = target
  534. newProp.CartoonFactor = 0.5
  535. newProp.MaxSpeed = MaxSpeed
  536. newProp.MaxThrust = maxThrust
  537. newProp.MaxTorque = v3(1/0,1/0,1/0)
  538. newProp.TurnD = 0
  539. newProp.TurnP = 0
  540. newProp.ThrustD = 0.001
  541. newProp.ThrustP = ThrustP
  542. newProp.TargetRadius = 8
  543. newProp.ReachedTarget:connect(function()
  544. end)
  545. return newProp
  546. end
  547.  
  548. function UpdatePropulsions()
  549. for i,v in pairs(RootPart:GetChildren()) do
  550. if v:IsA("RocketPropulsion") then
  551. v.MaxSpeed = MaxSpeed
  552. v.ThrustP = ThrustP
  553. end
  554. end
  555. end
  556.  
  557. function Grapple(side,to,spd)
  558. if not CanGrapple then return end
  559.  
  560. PlaySound(as.Shoot,mran2(4.5,5.5),1,Torso)
  561. local MouseCF = to
  562. local hit,hitpos
  563. local Drop = 0.1
  564.  
  565. if side == "q" then
  566. if qPart then qPart:Destroy() qPart=nil end
  567. if qProp then qProp:Destroy() qProp=nil end
  568.  
  569. qPart = iPart{Pack,1,2,1,an=true,co="Black",cf=cn(qbb.CFrame.p,MouseCF.p)*ca(-90,0,0)} qPart.Name = "qPart"
  570. iNew{"SpecialMesh",qPart,MeshId=as.Cone,Scale=v3(0.4,2,0.4)}
  571. qRope = iPart{qPart,1,1,1,an=true,co="Black"}
  572. iNew{"CylinderMesh",qRope}
  573.  
  574. for i=1,10000 do
  575. if not qPart then return end
  576. hit,hitpos = Raycast(qPart.Position,qPart.Position - (qPart.CFrame *cn(0,-1,0)).p,spd,Char)
  577. qPart.CFrame=qPart.CFrame*cn(0,spd,0)*ca(-Drop,0,0)
  578. if hit and hitpos and hit.Name~="unray" then
  579. PlaySound(as.Block,1,1,Torso)
  580. local pa,pb,pc=qPart.CFrame:toEulerAnglesXYZ()
  581. qPart.CFrame=cn(hitpos)*ca2(pa,pb,pc)
  582. qHit = hit
  583. qOffset = hit.CFrame:toObjectSpace(qPart.CFrame)
  584. if ePart and eHit then
  585. if qePart then qePart:Destroy() qePart=nil end
  586. if eProp then eProp:Destroy() eProp=nil end
  587. if qProp then qProp:Destroy() qProp=nil end
  588. if qeProp then qeProp:Destroy() qeProp=nil end
  589. qePart=iPart{Pack,1,1,1,tr=1,an=true,cf=cn(qPart.CFrame.p:Lerp(ePart.CFrame.p,0.5))}
  590. qeProp = AddRP(qePart,"qeProp",MaxThrust2)
  591. qeProp:Fire()
  592. elseif (ePart or not ePart) and not eHit then -- fixed glitch where trying to grapple and firing one
  593. qProp=AddRP(qPart,"qProp",MaxThrust1)
  594. qProp:Fire()
  595. end
  596. end
  597. if hit and hitpos then break end
  598. wait(0)
  599. end
  600.  
  601. elseif side == "e" then
  602. if ePart then ePart:Destroy() ePart=nil end
  603. if eProp then eProp:Destroy() eProp=nil end
  604.  
  605. ePart = iPart{Pack,1,2,1,an=true,co="Black",cf=cn(ebb.CFrame.p,MouseCF.p)*ca(-90,0,0)} ePart.Name = "ePart"
  606. iNew{"SpecialMesh",ePart,MeshId=as.Cone,Scale=v3(0.4,2,0.4)}
  607. eRope = iPart{ePart,1,1,1,an=true,co="Black"}
  608. iNew{"CylinderMesh",eRope}
  609.  
  610. for i=1,10000 do
  611. if not ePart then return end
  612. hit,hitpos = Raycast(ePart.Position,ePart.Position - (ePart.CFrame *cn(0,-1,0)).p,spd,Char)
  613. ePart.CFrame=ePart.CFrame*cn(0,spd,0)*ca(-Drop,0,0)
  614. if hit and hitpos and hit.Name~="unray" then
  615. PlaySound(as.Block,1,1,Torso,Torso)
  616. local pa,pb,pc=ePart.CFrame:toEulerAnglesXYZ()
  617. ePart.CFrame=cn(hitpos)*ca2(pa,pb,pc)
  618. eHit = hit
  619. eOffset = hit.CFrame:toObjectSpace(ePart.CFrame)
  620. if qPart and qHit then
  621. if qePart then qePart:Destroy() qePart=nil end
  622. if eProp then eProp:Destroy() eProp=nil end
  623. if qProp then qProp:Destroy() qProp=nil end
  624. if qeProp then qeProp:Destroy() qeProp=nil end
  625. qePart=iPart{Pack,1,1,1,tr=1,an=true,cf=cn(ePart.CFrame.p:Lerp(qPart.CFrame.p,0.5))}
  626. qeProp = AddRP(qePart,"qeProp",MaxThrust2)
  627. qeProp:Fire()
  628. elseif (qPart or not qPart) and not qHit then
  629. eProp=AddRP(ePart,"eProp",MaxThrust1)
  630. eProp:Fire()
  631. end
  632. end
  633. if hit and hitpos then break end
  634. wait(0)
  635. end
  636. end
  637. Humanoid.Jump=true
  638. Grappling=true
  639. --ReturnPose()
  640. --GrappleStance()
  641. end
  642.  
  643.  
  644.  
  645.  
  646. do
  647. Mouse=Player:GetMouse()
  648. Mouse.KeyDown:connect(function(key)
  649. keys[key]=true
  650. if Mouse and Mouse.Hit then
  651. -- Grapple
  652. if key == "q" then
  653. if not keys["g"] then
  654. Grapple("q",Mouse.Hit,18)
  655. end
  656. end
  657. if key == "e" then
  658. if not keys["g"] then
  659. Grapple("e",Mouse.Hit,18)
  660. end
  661. end
  662.  
  663. -- Jump
  664. if key == " " then
  665. Humanoid.PlatformStand=false
  666. Grappling=false
  667. if qPart then qPart:Destroy() qPart=nil qRope=nil qHit=nil end
  668. if ePart then ePart:Destroy() ePart=nil eRope=nil eHit=nil end
  669. if qePart then qePart:Destroy() qePart=nil end
  670. if qProp then qProp:Destroy() qProp=nil end
  671. if eProp then eProp:Destroy() eProp=nil end
  672. if qeProp then qeProp:Destroy() qeProp=nil end
  673. end
  674.  
  675. end
  676. end)
  677.  
  678. Mouse.KeyUp:connect(function(key)
  679. keys[key]=false
  680. if key == "q" then
  681. if keys["g"] then return end
  682. if not keys["e"] then Grappling=false end
  683. if qPart then qPart:Destroy() qPart=nil qRope = nil qHit=nil end
  684. if qePart then qePart:Destroy() qePart=nil end
  685. if qProp then qProp:Destroy() qProp=nil end
  686. if qeProp then qeProp:Destroy() qeProp=nil end
  687.  
  688. if keys["e"] then
  689. if ePart and not eProp and eHit then
  690. eProp=AddRP(ePart,"eProp",MaxThrust1)
  691. eProp:Fire()
  692. end
  693. end
  694. end
  695. if key == "e" then
  696. if keys["g"] then return end
  697. if not keys["q"] then Grappling=false end
  698. if ePart then ePart:Destroy() ePart=nil eRope = nil eHit=nil end
  699. if qePart then qePart:Destroy() qePart=nil end
  700. if eProp then eProp:Destroy() eProp=nil end
  701. if qeProp then qeProp:Destroy() qeProp=nil end
  702.  
  703. if keys["q"] then
  704. if qPart and not qProp and qHit then
  705. qProp=AddRP(qPart,"qProp",MaxThrust1)
  706. qProp:Fire()
  707. end
  708. end
  709. end
  710. if key == "g" then
  711. if keys["q"] or keys["e"] then return end
  712. Grappling=false
  713. if qPart then qPart:Destroy() qPart=nil qRope = nil qHit=nil end
  714. if ePart then ePart:Destroy() ePart=nil eRope = nil eHit=nil end
  715. if qePart then qePart:Destroy() qePart=nil end
  716. if qProp then qProp:Destroy() qProp=nil end
  717. if eProp then eProp:Destroy() eProp=nil end
  718. if qeProp then qeProp:Destroy() qeProp=nil end
  719. end
  720. end)
  721.  
  722. end
  723.  
  724.  
  725. Anim = ""
  726. Footsteps = {as.Footstep1,as.Footstep2,as.Footstep3}
  727. Grappling = false
  728. ASpeed = 9
  729. Attack = 1
  730. CurrentBlades = {nil,nil}
  731.  
  732. Humanoid.Died:connect(function() Pack:Destroy() script:Destroy() end)
  733. hpart = iPart{p,0.8,0.4,0.8}
  734. iNew{"Weld",p,Part0=belt,Part1=hpart,C0=cn(0,-0.1,0.9)*ca(15,0,0)}
  735. iNew{"CylinderMesh",hpart}
  736. hp2 = iPart{p,0.3,0.2,0.3}
  737. iNew{"Weld",p,Part0=hpart,Part1=hp2,C0=cn(0,0.1,0.5)}
  738. iNew{"BlockMesh",hp2,Scale=v3(0.5,0.5,1)}
  739. -- Main loop
  740. Count = 0
  741. game:GetService("RunService").RenderStepped:connect(function()
  742. Count = Count + 1
  743. if Pack.Parent then
  744. -- Grapple sticking
  745. if qOffset and qHit and qPart then
  746. qPart.CFrame = qHit.CFrame * qOffset
  747. end
  748. if eOffset and eHit and ePart then
  749. ePart.CFrame = eHit.CFrame * eOffset
  750. end
  751. if qPart and ePart and qePart then
  752. qePart.CFrame = cn(qPart.CFrame.p,ePart.CFrame.p)*cn(0,0,-(qPart.CFrame.p-ePart.CFrame.p).magnitude/2)
  753. end
  754. -- Rope
  755. if qRope then
  756. qRope.Mesh.Scale = v3(0.25,(qbb.CFrame.p-qPart.CFrame.p).magnitude,0.25)
  757. qRope.CFrame = cn(qbb.CFrame.p,qPart.CFrame.p)*ca(-90,0,0)*cn(0,(qbb.CFrame.p-qPart.CFrame.p).magnitude/2,0)
  758. end
  759. if eRope then
  760. eRope.Mesh.Scale = v3(0.25,(ebb.CFrame.p-ePart.CFrame.p).magnitude,0.25)
  761. eRope.CFrame = cn(ebb.CFrame.p,ePart.CFrame.p)*ca(-90,0,0)*cn(0,(ebb.CFrame.p-ePart.CFrame.p).magnitude/2,0)
  762. end
  763. -- Mouse gyro, force, and boosting
  764. if (qHit and qProp) or (eHit and eProp) or (qePart and qeProp) then
  765. if qProp then qProp:Fire() end
  766. if eProp then eProp:Fire() end
  767. if qeProp then qeProp:Fire() end
  768. RootPart.CFrame = cn(RootPart.CFrame.p,Mouse.Hit.p)
  769. if keys["4"] and Gas>0 then
  770. if Count%10==0 then
  771. iNew{"Smoke",hp2,Color=bc("Medium stone grey").Color,Opacity=0.5,RiseVelocity=7,Size=2}
  772. deb:AddItem(LastMade,1)
  773. Gas = Gas - 0.005
  774. end
  775. Force.force=RootPart.CFrame.lookVector*3000
  776. MaxSpeed = 400
  777. ThrustP = 5
  778. UpdatePropulsions()
  779. elseif not keys["4"] then
  780. Force.force=RootPart.CFrame.lookVector*0
  781. MaxSpeed = 300
  782. ThrustP = 5
  783. UpdatePropulsions()
  784. end
  785. elseif not qProp and not eProp and not qeProp then
  786. if not Anim == "Jump" and not Anim == "Flip Slash" then
  787. Force.force = v3(0,0,0)
  788. end
  789. end
  790. -- Walkspeed
  791. if WalkMode == "Walk" and Anim == "" then
  792. Humanoid.WalkSpeed = 10
  793. elseif WalkMode == "Run" and Anim == "" then
  794. Humanoid.WalkSpeed = 28
  795. end
  796. -- Sharpness and Gas
  797. if Sharpness <= 0 then
  798. Sharpness = 0
  799. if CurrentBlades[1] and CurrentBlades[2] then
  800. PlaySound(as.Disconnect,1,1,Torso)
  801. CurrentBlades[1].Part0 = nil
  802. CurrentBlades[1].Part1.CanCollide = true
  803. CurrentBlades[1] = nil
  804.  
  805. CurrentBlades[2].Part0 = nil
  806. CurrentBlades[2].Part1.CanCollide = true
  807. CurrentBlades[2] = nil
  808. end
  809. end
  810. if Gas <= 0 then
  811. Gas = 0
  812. end
  813. end
  814. end)
  815. --[[
  816. -- props (only really useful for when there is no map)
  817. for _,prop in pairs(workspace:GetChildren()) do
  818. if prop.Name=="prop" and prop:IsA("BasePart") then
  819. prop:Destroy()
  820. end
  821. end
  822. tp=iPart{workspace,80,5,700,cf=cn(0,200,600)*ca(15,0,0),an=true,ca=true} tp.Name="prop"
  823. for i=1,10 do
  824. local sizeY = mran(25,250)
  825. 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"
  826. end
  827. for i=1,100 do
  828. 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",
  829. cf=cn(mran(-150,150),250+(i*mran(80,120)),mran(-100,100))*ca(mran(-15,15),mran(-360,360),mran(-15,15))
  830. }
  831. tp.Name="prop"
  832. end]]
  833.  
Add Comment
Please, Sign In to add comment