Advertisement
IHATEMICROWAVEOVEN

pa mobile aiming v2 system

Mar 2nd, 2024 (edited)
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.74 KB | None | 0 0
  1. Hello!
  2. This will show you how to implement an improved mobile aiming system in your PA game.
  3. In this system, the move is instead cast on-release.
  4. Camera rotations of more than 10 degrees will not trigger a move (unless it was a brief tap).
  5. Very quick presses will always trigger a move.
  6. In all, this makes for a less annoying aiming system.
  7. Thank you for using this!
  8.  
  9.  
  10.  
  11.  
  12. To edit:
  13. All edits to the game are made through scripts, so just follow the text guides.
  14. We will be editing StarterGui > SkillsGui > WeaponsController, and performing edits to all ClientModules.
  15. I will show you an easy way to do the second one.
  16. A demonstration of where to paste everything will be present at the bottom of the guide.
  17.  
  18.  
  19.  
  20. 1. In StarterGui > SkillsGui > WeaponsController, find the function labelled Use.
  21.  
  22. Change the header from this:
  23. function Use()
  24.  
  25. to this:
  26. function Use(aimedDirection)
  27.  
  28.  
  29.  
  30. 2. In the same function, find where it declares a variable as "local returned".
  31.  
  32. Then, you change that line from this:
  33. local returned = func(game.Players.LocalPlayer, DeviceType, CallServer, CallWeaponServer)
  34.  
  35. to this:
  36. local returned = func(game.Players.LocalPlayer, DeviceType, CallServer, CallWeaponServer, (aimedDirection and aimedDirection or game.Players.LocalPlayer:GetMouse().Hit.LookVector))
  37.  
  38. Basically all this does is it takes the aimDirection parameter that we put in in Step 1, and passes it to a ClientModule whenever a move is used.
  39.  
  40.  
  41.  
  42.  
  43. 3. We are still in the same script. Scroll down to where it connects an event to UserInputService.InputBegan.
  44. Then, scroll down to the bottom of that function, where it says "elseif".
  45.  
  46. Replace this (sorry about the indents):
  47. elseif input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
  48. if not gp then
  49. if selectedweapon ~= nil then
  50. Use()
  51. end
  52. end
  53. end
  54.  
  55.  
  56.  
  57. with this:
  58. elseif input.UserInputType == Enum.UserInputType.MouseButton1 then
  59. if not gp then
  60. if selectedweapon ~= nil then
  61. Use()
  62. end
  63. end
  64. elseif input.UserInputType == Enum.UserInputType.Touch then
  65. if not gp then
  66. if selectedweapon ~= nil then
  67. local startedAtTime = tick()
  68. local startedAtRotation = workspace.CurrentCamera.CFrame.LookVector
  69. local endedAtDirection
  70. local gotVerdict = false
  71.  
  72.  
  73. local OnRelease = UserInputService.InputEnded:Connect(function(endedInput)
  74. if endedInput.UserInputType == Enum.UserInputType.Touch then
  75.  
  76. -- If the player has released their finger within 0.15 seconds of pressing, then count it as a click.
  77. -- Otherwise, see how far they've rotated their camera. If it's a small rotation, then count it as a click.
  78. -- (A small rotation is a change within 10 degrees.)
  79. local playerClicked = false
  80. if tick()-startedAtTime<0.15 then
  81. playerClicked = true
  82. else
  83. local endedAtRotation = workspace.CurrentCamera.CFrame.LookVector
  84.  
  85. -- :Dot checks how much two Vectors match in direction.
  86. -- If they face the same way, it returns 1. If they're perpendicular, then 0. Opposite directions is -1.
  87. if startedAtRotation:Dot(endedAtRotation) >= 80/90 then
  88. playerClicked = true
  89. end
  90. end
  91.  
  92. if playerClicked then
  93. local screenCoord = endedInput.Position
  94. endedAtDirection = workspace.CurrentCamera:ViewportPointToRay(screenCoord.X, screenCoord.Y).Direction
  95. -- This is basically the same as plr:GetMouse().Hit.LookVector
  96. end
  97.  
  98. gotVerdict = true
  99. end
  100. end)
  101.  
  102. repeat task.wait() until gotVerdict == true
  103. OnRelease:Disconnect()
  104.  
  105. if endedAtDirection then Use(endedAtDirection) end
  106. end
  107. end
  108. end
  109. end
  110. debounce = true
  111. end)
  112.  
  113.  
  114.  
  115. Congratulations! That's the important part of the code that makes the aiming actually good on mobile.
  116. However, the game currently doesn't recognize the direction we released at as our desired aim angle.
  117. Basically, if we were walking and using HydroPump (meaning we have one finger on the joystick)...
  118. then half the time, the game would aim it at the ground, because that's where it detects our "mouse."
  119. This is why we need to edit every ClientModule to use the passed aimDirection.
  120.  
  121.  
  122.  
  123. 4. So, how are we going to edit all 167+ attack scripts in your game?
  124. Well, we will take advantage of the fact that it's all copypasted in order to edit all of them simultaneously.
  125.  
  126. First, create a new Baseplate and paste your ClientModules Folder there.
  127. This is just a precaution to make sure we don't change anything erroneously with our "global edit".
  128.  
  129. Then, in that Baseplate, press Ctrl+Shift+F.
  130. Open the drop-down menu on the new window so that you have the option to search and replace.
  131.  
  132. Type this in "find" field:
  133. function Use(plr, device, CS, CWS)
  134.  
  135. And then this in the "replace" field:
  136. function Use(plr, device, CS, CWS, aimDirection)
  137.  
  138. Then, click Replace All. We have to do this one more time. Delete both text fields.
  139.  
  140. Type this in the "find" field:
  141. plr:GetMouse().hit.lookVector
  142.  
  143. And then this in the "replace" field:
  144. aimDirection
  145.  
  146. Now, Replace All yet again.
  147.  
  148.  
  149.  
  150. 5. Lastly, paste your newly edited ClientModules folder back into your game.
  151. (The edits may not have saved depending on your settings. I suggest publishing the Baseplate to prevent this.)
  152. Now, you've implemented the system completely! Good job!
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164. Paste Demonstration for WeaponsController:
  165. (note that this has remnants of the no-attack-latency system, so it's not completely vanilla)
  166.  
  167.  
  168.  
  169. game.ReplicatedStorage:WaitForChild("WEAPONFUNCTION")
  170.  
  171. local k = 0
  172.  
  173. function CallWeaponServer(...)
  174. return game.ReplicatedStorage.WEAPONFUNCTION:InvokeServer(...)
  175. end
  176.  
  177. game.ReplicatedStorage:WaitForChild("FUNCTION")
  178.  
  179. function CallServer(...)
  180. return game.ReplicatedStorage.FUNCTION:InvokeServer(...)
  181. end
  182.  
  183. local DeviceType = nil
  184. local selectedweapon = nil
  185. local weapons = {}
  186. k = CallServer("GetK", "sanspopsicles")
  187.  
  188. local gui = script.Parent
  189. local weaponsEvent = game:GetService("ReplicatedStorage"):WaitForChild("WeaponStatsEvent")
  190.  
  191.  
  192.  
  193. function Weap(t, id)
  194. if t == "E" then
  195. gui.Holder["Skill"..tostring(id)].ReloadBar.Visible = true
  196. gui.Holder["Skill"..tostring(id)].ReloadFullBar.Visible = true
  197. gui.Holder["Skill"..tostring(id)].ReloadText.Visible = true
  198. elseif t == "UE" then
  199. gui.Holder["Skill"..tostring(id)].ReloadBar.Visible = false
  200. gui.Holder["Skill"..tostring(id)].ReloadFullBar.Visible = false
  201. gui.Holder["Skill"..tostring(id)].ReloadText.Visible = false
  202. end
  203. end
  204.  
  205. function UpdateGui()
  206. for _, i in pairs(script.CurrentClientModules:GetChildren()) do i:Destroy() end
  207. for i = 1, 4 do
  208. if weapons[i] then
  209. if script.ClientModules:FindFirstChild(weapons[i]) then
  210. script.ClientModules[weapons[i]]:Clone().Parent = script.CurrentClientModules
  211. end
  212. end
  213. local frame = gui.Holder:FindFirstChild("Skill"..tostring(i))
  214. frame.SkillName.Text = weapons[i] or " "
  215. end
  216. end
  217.  
  218. function UpdateGuiDevice()
  219. local function Check(loc)
  220. for _, i in pairs(loc:GetChildren()) do
  221. if i:IsA'Frame' then
  222. Check(i)
  223. else
  224. if i.Name == DeviceType.."HotKeys" then
  225. i.Visible = true
  226. elseif string.find(i.Name, "HotKeys") then
  227. i.Visible = false
  228. end
  229. end
  230. end
  231. end
  232. Check(gui.Holder)
  233. end
  234.  
  235. function SkillCUC(t, i)
  236. if t == "C" then
  237. local frame = gui.Holder:FindFirstChild("Skill"..tostring(i))
  238. frame.SkillName.TextColor3 = Color3.new(47/255, 187/255, 200/255)
  239. elseif t == "UC" then
  240. local frame = gui.Holder:FindFirstChild("Skill"..tostring(i))
  241. frame.SkillName.TextColor3 = Color3.new(1,1,1)
  242. end
  243. end
  244. function SetupGui()
  245. script.Parent.Holder.Visible = true
  246. for i = 1, 4 do
  247. local frame = gui.Holder:FindFirstChild("Skill"..tostring(i))
  248. frame.SkillName.Text = weapons[i] or " "
  249. frame.SkillName.MouseButton1Click:connect(function()
  250. if weapons[i] ~= nil then
  251. SelectWeapon(i)
  252. end
  253. end)
  254. end
  255. end
  256.  
  257. local debounce = {[1] = true, [2] = true, [3] = true, [4] = true}
  258. local debounceuse = true
  259. local LastUse = tick()
  260.  
  261. local SLPvalue = 0
  262. local PvPvalue = 0
  263.  
  264. -- NEW STUFF
  265. -- NEW STUFF
  266. -- NEW STUFF
  267. -- NEW STUFF
  268. -- NEW STUFF
  269. -- NEW STUFF
  270. -- NEW STUFF
  271. -- NEW STUFF
  272. -- NEW STUFF
  273. -- NEW STUFF
  274. -- NEW STUFF
  275. -- NEW STUFF
  276. -- NEW STUFF
  277. -- NEW STUFF
  278. -- NEW STUFF. Please paste the below line over its original version.
  279. function Use(aimedDirection)
  280. -- This is what the original line said:
  281. -- function Use()
  282. -- END OF NEW STUFF
  283. -- END OF NEW STUFF
  284. -- END OF NEW STUFF
  285. -- END OF NEW STUFF
  286. -- END OF NEW STUFF
  287. -- END OF NEW STUFF
  288. -- END OF NEW STUFF
  289. -- END OF NEW STUFF
  290. -- END OF NEW STUFF
  291. -- END OF NEW STUFF
  292. -- END OF NEW STUFF
  293. -- END OF NEW STUFF
  294. -- END OF NEW STUFF
  295. -- END OF NEW STUFF
  296. -- END OF NEW STUFF
  297. local curweaponf = selectedweapon
  298. if debounceuse then
  299. debounceuse = false
  300. if debounce[curweaponf] then
  301. if PvPvalue == 1 then
  302. if SLPvalue == 0 and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character.Humanoid.Health > 0 then
  303. if script.CurrentClientModules:FindFirstChild(weapons[curweaponf]) then
  304. game.Players.LocalPlayer.PlayerGui.GameGui.LocalScript.WeaponUsed.Value = true
  305. debounce[curweaponf] = false
  306. local tab = require(script.CurrentClientModules[weapons[curweaponf]])
  307. local func = tab[1]
  308. local reload = tab[2]
  309. coroutine.wrap(function()
  310. -- NEW STUFF
  311. -- NEW STUFF
  312. -- NEW STUFF
  313. -- NEW STUFF
  314. -- NEW STUFF
  315. -- NEW STUFF
  316. -- NEW STUFF
  317. -- NEW STUFF
  318. -- NEW STUFF
  319. -- NEW STUFF
  320. -- NEW STUFF
  321. -- NEW STUFF
  322. -- NEW STUFF
  323. -- NEW STUFF
  324. -- NEW STUFF. Please paste the below line over its original version.
  325. local returned = func(game.Players.LocalPlayer, DeviceType, CallServer, CallWeaponServer,
  326. (aimedDirection and aimedDirection or game.Players.LocalPlayer:GetMouse().Hit.LookVector))
  327. -- This is what the original line said:
  328. -- local returned = func(game.Players.LocalPlayer, DeviceType, CallServer, CallWeaponServer)
  329. -- END OF NEW STUFF
  330. -- END OF NEW STUFF
  331. -- END OF NEW STUFF
  332. -- END OF NEW STUFF
  333. -- END OF NEW STUFF
  334. -- END OF NEW STUFF
  335. -- END OF NEW STUFF
  336. -- END OF NEW STUFF
  337. -- END OF NEW STUFF
  338. -- END OF NEW STUFF
  339. -- END OF NEW STUFF
  340. -- END OF NEW STUFF
  341. -- END OF NEW STUFF
  342. -- END OF NEW STUFF
  343. -- END OF NEW STUFF
  344. if returned ~= nil then
  345. reload = returned
  346. end
  347. LastUse = tick()
  348. --print(reload)
  349. end)()
  350. coroutine.wrap(function()
  351. local i = 0
  352. while i < reload do
  353. if 0.8 * (i / (reload)) < 0.1 then
  354. gui.Holder["Skill"..tostring(curweaponf)].ReloadBar:TweenSize(UDim2.new(0.1, 0, -0.15, 0), "Out", "Quad", 1, true)
  355. else
  356. gui.Holder["Skill"..tostring(curweaponf)].ReloadBar:TweenSize(UDim2.new(0.8 * (i / (reload)), 0, -0.15, 0), "Out", "Quad", 1, true)
  357. end
  358. gui.Holder["Skill"..tostring(curweaponf)].ReloadText.Text = "Reloading!"
  359. i = i + wait(1/60)
  360. end
  361. gui.Holder["Skill"..tostring(curweaponf)].ReloadBar:TweenSize(UDim2.new(0.8, 0, -0.15, 0), "Out", "Quad", 1, true)
  362. gui.Holder["Skill"..tostring(curweaponf)].ReloadText.Text = "Ready!"
  363. debounce[curweaponf] = true
  364. end)()
  365. SkillCUC("UC", curweaponf)
  366. selectedweapon = nil
  367. end
  368. end
  369. else
  370. game.StarterGui:SetCore("SendNotification", {
  371. Title = "Skills";
  372. Text = "Turned the PvP on!";
  373. Duration = 2;
  374. })
  375. CallServer("ChangeStat", k, "PvP", 1)
  376. end
  377. end
  378. wait(2)
  379. debounceuse = true
  380. end
  381. end
  382.  
  383. function SelectWeapon(num)
  384. if weapons[num] ~= nil then
  385. if selectedweapon == num then
  386. selectedweapon = nil
  387. SkillCUC("UC", num)
  388. else
  389. selectedweapon = num
  390. SkillCUC("C", num)
  391. if num ~= 1 then SkillCUC("UC", 1) end
  392. if num ~= 2 then SkillCUC("UC", 2) end
  393. if num ~= 3 then SkillCUC("UC", 3) end
  394. if num ~= 4 then SkillCUC("UC", 4) end
  395. end
  396. end
  397. end
  398. game.Players.LocalPlayer.Backpack.ChildAdded:connect(function(i)
  399. if script.ClientModules:FindFirstChild(i.Name) then
  400. script.ClientModules[i.Name]:Clone().Parent = script.CurrentClientModules
  401. end
  402. if weapons[1] == nil then table.insert(weapons, 1, i.Name) Weap("E", 1)
  403. elseif weapons[2] == nil then table.insert(weapons, 2, i.Name) Weap("E", 2)
  404. elseif weapons[3] == nil then table.insert(weapons, 3, i.Name) Weap("E", 3)
  405. elseif weapons[4] == nil then table.insert(weapons, 4, i.Name) Weap("E", 4)
  406. end
  407. UpdateGui()
  408. end)
  409. game.Players.LocalPlayer.Backpack.ChildRemoved:connect(function(i)
  410. if script.CurrentClientModules:FindFirstChild(i.Name) then
  411. script.CurrentClientModules[i.Name]:Destroy()
  412. end
  413. if weapons[1] == i.Name then weapons[1] = nil Weap("UE", 1) if selectedweapon == 1 then selectedweapon = nil SkillCUC("UC", 1) end
  414. elseif weapons[2] == i.Name then weapons[2] = nil Weap("UE", 2) if selectedweapon == 2 then selectedweapon = nil SkillCUC("UC", 2) end
  415. elseif weapons[3] == i.Name then weapons[3] = nil Weap("UE", 3) if selectedweapon == 3 then selectedweapon = nil SkillCUC("UC", 3) end
  416. elseif weapons[4] == i.Name then weapons[4] = nil Weap("UE", 4) if selectedweapon == 4 then selectedweapon = nil SkillCUC("UC", 4) end
  417. end
  418. UpdateGui()
  419. end)
  420. repeat wait() until weapons[1] ~= nil
  421. SetupGui()
  422. local debounce = true
  423. local UserInputService = game:GetService("UserInputService")
  424. UserInputService.InputBegan:connect(function(input, gp)
  425. if debounce then
  426. debounce = false
  427. if input.UserInputType == Enum.UserInputType.Gamepad1 or input.UserInputType == Enum.UserInputType.Keyboard then
  428. -- EXECUTING
  429. if input.KeyCode == Enum.KeyCode.Q or input.KeyCode == Enum.KeyCode.ButtonL1 then
  430. if weapons[1] ~= nil then
  431. SelectWeapon(1)
  432. end
  433. elseif input.KeyCode == Enum.KeyCode.E or input.KeyCode == Enum.KeyCode.ButtonL2 then
  434. if weapons[2] ~= nil then
  435. SelectWeapon(2)
  436. end
  437. elseif input.KeyCode == Enum.KeyCode.R or input.KeyCode == Enum.KeyCode.ButtonR2 then
  438. if weapons[3] ~= nil then
  439. SelectWeapon(3)
  440. end
  441. elseif input.KeyCode == Enum.KeyCode.T or input.KeyCode == Enum.KeyCode.ButtonR1 then
  442. if weapons[4] ~= nil then
  443. SelectWeapon(4)
  444. end
  445. elseif input.KeyCode == Enum.KeyCode.ButtonX then
  446. if selectedweapon ~= nil then
  447. Use()
  448. end
  449. end
  450. -- NEW STUFF
  451. -- NEW STUFF
  452. -- NEW STUFF
  453. -- NEW STUFF
  454. -- NEW STUFF
  455. -- NEW STUFF
  456. -- NEW STUFF
  457. -- NEW STUFF
  458. -- NEW STUFF
  459. -- NEW STUFF
  460. -- NEW STUFF
  461. -- NEW STUFF
  462. -- NEW STUFF
  463. -- NEW STUFF
  464. -- NEW STUFF
  465. -- NEW STUFF
  466. -- NEW STUFF
  467. -- NEW STUFF
  468. -- NEW STUFF
  469. -- NEW STUFF
  470. elseif input.UserInputType == Enum.UserInputType.MouseButton1 then
  471. if not gp then
  472. if selectedweapon ~= nil then
  473. Use()
  474. end
  475. end
  476. elseif input.UserInputType == Enum.UserInputType.Touch then
  477. if not gp then
  478. if selectedweapon ~= nil then
  479. local startedAtTime = tick()
  480. local startedAtRotation = workspace.CurrentCamera.CFrame.LookVector
  481. local endedAtDirection
  482. local gotVerdict = false
  483.  
  484.  
  485. local OnRelease = UserInputService.InputEnded:Connect(function(endedInput)
  486. if endedInput.UserInputType == Enum.UserInputType.Touch then
  487.  
  488. -- If the player has released their finger within 0.15 seconds of pressing, then count it as a click.
  489. -- Otherwise, see how far they've rotated their camera. If it's a small rotation, then count it as a click.
  490. -- (A small rotation is a change within 10 degrees.)
  491. local playerClicked = false
  492. if tick()-startedAtTime<0.15 then
  493. playerClicked = true
  494. else
  495. local endedAtRotation = workspace.CurrentCamera.CFrame.LookVector
  496.  
  497. -- :Dot checks how much two Vectors match in direction.
  498. -- If they face the same way, it returns 1. If they're perpendicular, then 0. Opposite directions is -1.
  499. if startedAtRotation:Dot(endedAtRotation) >= 80/90 then
  500. playerClicked = true
  501. end
  502. end
  503.  
  504. if playerClicked then
  505. local screenCoord = endedInput.Position
  506. endedAtDirection = workspace.CurrentCamera:ViewportPointToRay(screenCoord.X, screenCoord.Y).Direction
  507. -- This is basically the same as plr:GetMouse().Hit.LookVector
  508. end
  509.  
  510. gotVerdict = true
  511. end
  512. end)
  513.  
  514. repeat task.wait() until gotVerdict == true
  515. OnRelease:Disconnect()
  516.  
  517. if endedAtDirection then Use(endedAtDirection) end
  518. end
  519. end
  520.  
  521. end
  522. -- END OF NEW STUFF
  523. -- END OF NEW STUFF
  524. -- END OF NEW STUFF
  525. -- END OF NEW STUFF
  526. -- END OF NEW STUFF
  527. -- END OF NEW STUFF
  528. -- END OF NEW STUFF
  529. -- END OF NEW STUFF
  530. -- END OF NEW STUFF
  531. -- END OF NEW STUFF
  532. -- END OF NEW STUFF
  533. -- END OF NEW STUFF
  534. -- END OF NEW STUFF
  535. -- END OF NEW STUFF
  536. -- END OF NEW STUFF
  537. -- END OF NEW STUFF
  538. -- END OF NEW STUFF
  539. -- END OF NEW STUFF
  540. -- END OF NEW STUFF
  541. -- END OF NEW STUFF
  542.  
  543.  
  544. debounce = true
  545. end
  546. end)
  547.  
  548. local UIS = game:GetService("UserInputService")
  549. if UIS.GamepadEnabled then
  550. DeviceType = "Gamepad"
  551. UpdateGuiDevice()
  552. elseif UIS.MouseEnabled then
  553. DeviceType = "Pc"
  554. UpdateGuiDevice()
  555. elseif UIS.TouchEnabled then
  556. DeviceType = "Mobile"
  557. UpdateGuiDevice()
  558. end
  559. UIS.GamepadConnected:connect(function(GPN)
  560. if GPN == Enum.UserInputType.Gamepad1 then
  561. DeviceType = "Gamepad"
  562. UpdateGuiDevice()
  563. end
  564. end)
  565. UIS.GamepadDisconnected:connect(function(GPN)
  566. if GPN == Enum.UserInputType.Gamepad1 then
  567. if UIS.MouseEnabled then
  568. DeviceType = "Pc"
  569. UpdateGuiDevice()
  570. elseif UIS.TouchEnabled then
  571. DeviceType = "Mobile"
  572. UpdateGuiDevice()
  573. end
  574. end
  575. end)
  576.  
  577. spawn(function()
  578. local CurHP = CallServer("GetHP")
  579. local LastHPChange = tick()
  580. while wait(1) do
  581. local HP = CallServer("GetHP")
  582. if HP < CurHP then LastHPChange = tick() end
  583. CurHP = HP
  584. if tick() - LastUse > 6 and tick() - LastHPChange > 6 then
  585. CallServer("HealPlayer", 10)
  586. LastUse = tick()
  587. end
  588. end
  589. end)
  590.  
  591.  
  592. weaponsEvent.OnClientEvent:Connect(function(...)
  593. local args = {...}
  594. --[1]: the name of a stat
  595. --[2]: the stat's new value
  596.  
  597. if args[1]=="SLP" then
  598. SLPvalue = args[2]
  599. elseif args[1]=="PvP" then
  600. PvPvalue = args[2]
  601. end
  602. end)
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613. Paste Demonstration for a ClientModule script:
  614. (note that this is just an example for you to see if you did it right)
  615.  
  616. -- SETTINGS
  617. local reload = 4
  618. local name = "Absorb"
  619. -- SCRIPT
  620. local debounce = true
  621. -- NEW STUFF
  622. -- NEW STUFF
  623. -- NEW STUFF
  624. function Use(plr, device, CS, CWS, aimDirection)
  625. -- Original line:
  626. -- function Use(plr, device, CS, CWS)
  627. -- END OF NEW STUFF
  628. -- END OF NEW STUFF
  629. -- END OF NEW STUFF
  630. if debounce then
  631. debounce = false
  632. local target = nil
  633. if CS("GetStat", "NewAim") == 1 then
  634. -- NEW STUFF
  635. -- NEW STUFF
  636. -- NEW STUFF
  637. target = aimDirection * 120
  638. -- Original line: target = plr:GetMouse().hit.lookVector * 120
  639. -- Note that the 120 varies from move to move.
  640. -- END OF NEW STUFF
  641. -- END OF NEW STUFF
  642. -- END OF NEW STUFF
  643. -- END OF NEW STUFF
  644. else
  645. target = plr.Character.Torso.CFrame.lookVector * 120
  646. end
  647. CWS("RunWeapon", name, target)
  648. wait(0.5)
  649. debounce = true
  650. end
  651. end
  652.  
  653. return {Use, reload}
  654.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement