Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 44.28 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2. wait()
  3. local UIS = game:GetService("UserInputService")
  4. local CAS = game:GetService("ContextActionService")
  5. local RS = game:GetService("ReplicatedStorage")
  6. local plr = game.Players.LocalPlayer
  7. local char = plr.Character
  8. if not char or not char.Parent then
  9. char = plr.CharacterAdded:wait()
  10. end
  11. local WallRotation = 0
  12. local pushforce = Vector3.new(0, 0, 0)
  13. local Power = "Spiderman"
  14. local Mode = "Idle"
  15. local auto = true
  16. local CanWallclimb = false
  17. local NormalVector = Vector3.new(1, 0, 0)
  18. local AtkDebounce = false
  19. local UltDebounce = false
  20. local UltAtkDebounce = false
  21. local UltActive = false
  22. local interaction
  23. local ThumbstickDir = math.pi / 2
  24. local input = {}
  25. local humanoid = char:WaitForChild("Humanoid")
  26. local Defaultanim = Instance.new("Animation")
  27. local charlist = {}
  28. Defaultanim.AnimationId = "rbxassetid://1021993937"
  29. local DefaultPlay = humanoid:LoadAnimation(Defaultanim)
  30. local Atkanim = Instance.new("Animation")
  31. Atkanim.AnimationId = "rbxassetid://1008473434"
  32. local Atkplay2 = humanoid:LoadAnimation(Atkanim)
  33. local OnMobile = _G.OnMobile
  34. local OnConsole = _G.OnConsole
  35. _G.isInteracting = false
  36. local m = plr:GetMouse()
  37. local list = {}
  38. local Stamina = 100
  39. for _, v in pairs(workspace.OnomatopoeiaParts:GetChildren()) do
  40. v:destroy()
  41. end
  42. local OriginalEnviromentPosition = {}
  43. local CreateInstance = function(classname, info)
  44. local instance = Instance.new(classname)
  45. for i, v in pairs(info) do
  46. instance[i] = v
  47. end
  48. return instance
  49. end
  50. local resetBindable = Instance.new("BindableEvent")
  51. resetBindable.Event:connect(function()
  52. CAS:UnbindAction("Activate ULT")
  53. CAS:UnbindAction("WebSwing")
  54. CAS:UnbindAction("WallClimb")
  55. game.ReplicatedStorage.RemoteEvents.Reset:FireServer(Power)
  56. end)
  57. local attemptnr = 0
  58. local function Reset()
  59. if attemptnr < 100 then
  60. local success = pcall(function()
  61. game:GetService("StarterGui"):SetCore("ResetButtonCallback", resetBindable)
  62. end)
  63. if success == false then
  64. attemptnr = attemptnr + 1
  65. game:GetService("RunService").RenderStepped:wait()
  66. Reset()
  67. end
  68. else
  69. end
  70. end
  71. coroutine.resume(coroutine.create(function()
  72. Reset()
  73. end))
  74. function AutoAim(arm)
  75. local floor, floorpos = workspace:FindPartOnRayWithIgnoreList(Ray.new(char.HumanoidRootPart.Position, Vector3.new(0, -1000, 0)), charlist)
  76. if floor == nil then
  77. floorpos = Vector3.new(char.HumanoidRootPart.Position.X, 10, char.HumanoidRootPart.Position.Z)
  78. end
  79. local floorpos = floorpos + Vector3.new(0, 100, 0)
  80. local direction = CFrame.new(floorpos, floorpos + Vector3.new(workspace.CurrentCamera.CFrame.lookVector.X, 0, workspace.CurrentCamera.CFrame.lookVector.Z))
  81. if pushforce.magnitude < 0.2 then
  82. direction = CFrame.new(workspace.CurrentCamera.CFrame.p.X, floorpos.Y, workspace.CurrentCamera.CFrame.p.Z)
  83. end
  84. local fortegn = 1
  85. if arm == "RightHand" then
  86. fortegn = -1
  87. end
  88. local offset = 0
  89. local wall, wallpos
  90. repeat
  91. offset = offset + 1
  92. local dir = direction * CFrame.Angles(0, fortegn * math.pi / 50 * offset, 0)
  93. wall, wallpos = workspace:FindPartOnRayWithIgnoreList(Ray.new(direction.p, dir.lookVector * 225), charlist)
  94. if wall ~= nil and wall.Transparency == 1 then
  95. wall = nil
  96. end
  97. until offset >= 30 or wall ~= nil
  98. if wall ~= nil then
  99. return wall, Vector3.new(wallpos.X, wall.Position.Y + wall.Size.Y / 2 - 1, wallpos.Z)
  100. end
  101. end
  102. function RayFunction(origin, direction, startpoint, part)
  103. local point = origin + direction + CFrame.new(Vector3.new(0, 0, 0), direction):pointToWorldSpace(Vector3.new(math.random(1, 18) / 10 - 0.9, math.random(1, 18) / 10 - 0.9, 0))
  104. local part = part
  105. if part then
  106. if part:FindFirstChild("Mesh") then
  107. part.CFrame = CFrame.new(startpoint + (point - startpoint) / 2, point)
  108. part.Mesh.Scale = Vector3.new(0.2, 0.2, point - startpoint.magnitude)
  109. end
  110. else
  111. part = Instance.new("Part")
  112. local mesh = Instance.new("BlockMesh", part)
  113. mesh.Scale = Vector3.new(0.2, 0.2, point - startpoint.magnitude)
  114. part.Size = Vector3.new(1, 1, 1)
  115. part.CFrame = CFrame.new(startpoint + (point - startpoint) / 2, point)
  116. part.Anchored = true
  117. part.Material = "Neon"
  118. part.BrickColor = BrickColor.new("Pastel violet")
  119. part.CanCollide = false
  120. part.Parent = char
  121. end
  122. return point, part
  123. end
  124. function RayHit(part, position, direction)
  125. local depth = math.random(1, 10)
  126. local x = math.random(1, 30)
  127. local onopos = CFrame.new(position, position - direction):toWorldSpace(CFrame.new(4 * math.cos(2 * x * math.pi / 30), 2 * math.sin(2 * x * math.pi / 30) + 1, -depth / 10 - 0.5))
  128. Onomatopoeia("Zap!", onopos)
  129. end
  130. function FireRay(origin, direction, chr)
  131. local tid = tick()
  132. local origtid = tick()
  133. local part
  134. local offset1 = origin
  135. local offset2 = origin
  136. local offset3 = origin
  137. local part1, part2, part3, position
  138. repeat
  139. game:GetService("RunService").Stepped:wait()
  140. game:GetService("RunService").Stepped:wait()
  141. local delta = tick() - tid
  142. tid = tick()
  143. local ray = Ray.new(origin, direction * delta)
  144. part, position = workspace:FindPartOnRayWithIgnoreList(ray, {
  145. chr,
  146. workspace.Triggers
  147. })
  148. offset1, part1 = RayFunction(origin, direction * delta, offset1, part1)
  149. offset3, part3 = RayFunction(origin, direction * delta, offset1, part3)
  150. offset2, part2 = RayFunction(origin, direction * delta, offset2, part2)
  151. origin = origin + direction * delta
  152. until part or tick() - origtid > 2
  153. if part then
  154. RayHit(part, position, direction)
  155. end
  156. part1:destroy()
  157. part2:destroy()
  158. part3:destroy()
  159. return part
  160. end
  161. function ChargeRay(chr, target)
  162. local tid = tick()
  163. local origtid = tick()
  164. local rightA = target - chr.RightHand.Position.magnitude
  165. local leftA = target - chr.LeftHand.Position.magnitude
  166. local left1 = {}
  167. local left2 = {}
  168. local right1 = {}
  169. local right2 = {}
  170. for i = 1, math.ceil(leftA / 7) + 1 do
  171. left1[i] = {
  172. offset = chr.LeftHand.Position
  173. }
  174. left2[i] = {
  175. offset = chr.LeftHand.Position
  176. }
  177. end
  178. for i = 1, math.ceil(rightA / 7) + 1 do
  179. right1[i] = {
  180. offset = chr.RightHand.Position
  181. }
  182. right2[i] = {
  183. offset = chr.RightHand.Position
  184. }
  185. end
  186. repeat
  187. game:GetService("RunService").Stepped:wait()
  188. game:GetService("RunService").Stepped:wait()
  189. local rightdirection = target - chr.RightHand.Position
  190. local leftdirection = target - chr.LeftHand.Position
  191. right1[1].offset = chr.RightHand.Position
  192. left1[1].offset = chr.LeftHand.Position
  193. right2[1].offset = chr.RightHand.Position
  194. left2[1].offset = chr.LeftHand.Position
  195. for i = 1, math.ceil(rightdirection.magnitude / 7) do
  196. local length = 7
  197. if 7 > chr.RightHand.Position + rightdirection.unit * 7 * (i - 1) - target.magnitude then
  198. length = chr.RightHand.Position + rightdirection.unit * 7 * (i - 1) - target.magnitude
  199. end
  200. local holder
  201. holder, right1[i].part = RayFunction(chr.RightHand.Position + rightdirection.unit * 7 * (i - 1), rightdirection.unit * length, right1[i].offset, right1[i].part)
  202. if right1[i + 1] then
  203. right1[i + 1].offset = holder
  204. end
  205. holder, right2[i].part = RayFunction(chr.RightHand.Position + rightdirection.unit * 7 * (i - 1), rightdirection.unit * length, right2[i].offset, right2[i].part)
  206. if right2[i + 1] then
  207. right2[i + 1].offset = holder
  208. end
  209. holder, left1[i].part = RayFunction(chr.LeftHand.Position + leftdirection.unit * 7 * (i - 1), leftdirection.unit * length, left1[i].offset, left1[i].part)
  210. if left1[i + 1] then
  211. left1[i + 1].offset = holder
  212. end
  213. holder, left2[i].part = RayFunction(chr.LeftHand.Position + leftdirection.unit * 7 * (i - 1), leftdirection.unit * length, left2[i].offset, left2[i].part)
  214. if left2[i + 1] then
  215. left2[i + 1].offset = holder
  216. end
  217. end
  218. until chr.HumanoidRootPart:FindFirstChild("ElectricGyro") == nil
  219. for i = 1, math.ceil(leftA / 7) + 1 do
  220. if left1[i].part ~= nil then
  221. left1[i].part:destroy()
  222. left2[i].part:destroy()
  223. end
  224. end
  225. for i = 1, math.ceil(rightA / 7) + 1 do
  226. if right1[i].part ~= nil then
  227. right1[i].part:destroy()
  228. right2[i].part:destroy()
  229. end
  230. end
  231. left1, left2, right1, right2 = nil, nil, nil, nil
  232. end
  233. function UltimateRay(chr)
  234. local tid = tick()
  235. local origtid = tick()
  236. local opponents = {}
  237. repeat
  238. game:GetService("RunService").Stepped:wait()
  239. game:GetService("RunService").Stepped:wait()
  240. for _, v in pairs(workspace.NPCs:GetChildren()) do
  241. local direction = v.HumanoidRootPart.Position - chr.UpperTorso.Position
  242. if direction.magnitude < 21 then
  243. if opponents[v] == nil then
  244. opponents[v] = {}
  245. for q = 1, 2 do
  246. opponents[v][q] = {
  247. part = {},
  248. offset = {}
  249. }
  250. end
  251. end
  252. for q = 1, 2 do
  253. opponents[v][q].offset[1] = chr.UpperTorso.Position
  254. for i = 1, math.ceil(direction.magnitude / 7) do
  255. local length = 7
  256. if 7 > chr.UpperTorso.Position + direction.unit * 7 * (i - 1) - v.HumanoidRootPart.Position.magnitude then
  257. length = chr.UpperTorso.Position + direction.unit * 7 * (i - 1) - v.HumanoidRootPart.Position.magnitude
  258. end
  259. local holder
  260. holder, opponents[v][q].part[i] = RayFunction(chr.UpperTorso.Position + direction.unit * 7 * (i - 1), direction.unit * length, opponents[v][q].offset[i], opponents[v][q].part[i])
  261. if i < math.ceil(direction.magnitude / 7) then
  262. opponents[v][q].offset[i + 1] = holder
  263. elseif opponents[v][q].part[i + 1] then
  264. opponents[v][q].part[i + 1]:destroy()
  265. opponents[v][q].offset[i + 1] = nil
  266. end
  267. end
  268. end
  269. elseif opponents[v] then
  270. for q = 1, 2 do
  271. for _, x in pairs(opponents[v][q].part) do
  272. x:destroy()
  273. end
  274. end
  275. opponents[v] = nil
  276. end
  277. end
  278. until tick() - tid >= 10
  279. for _, v in pairs(opponents) do
  280. for q = 1, 2 do
  281. for _, x in pairs(v[q].part) do
  282. x:destroy()
  283. end
  284. end
  285. end
  286. opponents = nil
  287. end
  288. function FindShortestDistance(point1, point2, offsetpoint)
  289. local v = point2 - point1
  290. local sin = v.unit:Cross(offsetpoint - point1.unit).magnitude
  291. local cos = v.unit * offsetpoint - point1.unit.magnitude
  292. return math.abs(sin * offsetpoint - point1.magnitude), cos, v.unit:Dot(offsetpoint - point1.unit)
  293. end
  294. function Onomatopoeia(name, pos, f, variable)
  295. coroutine.resume(coroutine.create(function()
  296. local part = game.ReplicatedStorage.Onomatopoetikon:clone()
  297. local gui = part.BillboardGui
  298. gui.ImageLabel.Image = "rbxgameasset://Images/" .. name
  299. part.Name = name
  300. part.CFrame = pos
  301. part.Parent = workspace.OnomatopoeiaParts
  302. local tid = tick()
  303. repeat
  304. local size = (tick() - tid) / 0.2 * 5
  305. gui.Size = UDim2.new(size, 0, size, 0)
  306. game:GetService("RunService").RenderStepped:wait()
  307. until tick() - tid >= 0.2
  308. tid = tick()
  309. repeat
  310. local size = 5 + math.sin(5 * math.pi * (tick() - tid) / 0.2)
  311. gui.Size = UDim2.new(size, 0, size, 0)
  312. game:GetService("RunService").RenderStepped:wait()
  313. until tick() - tid >= 0.2
  314. tid = tick()
  315. repeat
  316. local size = 5 - (tick() - tid) / 0.2 * 5
  317. gui.Size = UDim2.new(size, 0, size, 0)
  318. game:GetService("RunService").RenderStepped:wait()
  319. until tick() - tid >= 0.2
  320. part:destroy()
  321. end))
  322. end
  323. game.ReplicatedStorage.RemoteEvents.Onomatopoeia.OnClientEvent:connect(function(name, pos, f, variable)
  324. Onomatopoeia(name, pos, f, variable)
  325. end)
  326. function RayCheck(origin, direction)
  327. local hit
  328. local ray = Ray.new(origin, direction)
  329. local ignorelist = {}
  330. for _, v in pairs(game.Players:GetPlayers()) do
  331. table.insert(ignorelist, v.Character)
  332. end
  333. local part, position = workspace:FindPartOnRayWithIgnoreList(ray, ignorelist)
  334. if part and part.Transparency < 1 then
  335. hit = position
  336. end
  337. return part, position
  338. end
  339. local function EndWallClimb()
  340. char.Humanoid.AutoRotate = true
  341. char.HumanoidRootPart.Anchored = false
  342. end
  343. local function TransitionSurface(origcframe, newcframe)
  344. local origtid = tick()
  345. local tid = tick()
  346. repeat
  347. game:GetService("RunService").Heartbeat:wait()
  348. char.HumanoidRootPart.CFrame = origcframe:lerp(newcframe, (tick() - origtid) / 0.5)
  349. until tick() - origtid >= 0.5
  350. end
  351. local function WallClimb()
  352. local wall, position = workspace:FindPartOnRayWithIgnoreList(Ray.new(char.HumanoidRootPart.CFrame.p, -NormalVector * 15), charlist)
  353. if char.RightHand:FindFirstChild("RightHandForce") or char.LeftHand:FindFirstChild("LeftHandForce") then
  354. if char.LeftHand:FindFirstChild("LeftHandForce") then
  355. EndWebsling(char.LeftHand)
  356. end
  357. if char.RightHand:FindFirstChild("RightHandForce") then
  358. EndWebsling(char.RightHand)
  359. end
  360. wait()
  361. end
  362. if wall and Mode ~= "WallClimbing" and NormalVector:Dot(Vector3.new(0, 1, 0)) < 0.3 then
  363. local Wallclimbanim = Instance.new("Animation")
  364. Wallclimbanim.AnimationId = "rbxassetid://1034576967"
  365. local Wallclimbtrack = humanoid:LoadAnimation(Wallclimbanim)
  366. Wallclimbtrack:Play(0.1, 1, 0)
  367. Mode = "WallClimbing"
  368. char.HumanoidRootPart.Velocity = Vector3.new(0, 0, 0)
  369. char.HumanoidRootPart.Anchored = true
  370. char.Humanoid.AutoRotate = false
  371. char.HumanoidRootPart.CFrame = CFrame.new(position + NormalVector * 0.75 + Vector3.new(0, 1, 0), position + Vector3.new(0, 1, 0))
  372. local transition = false
  373. local tid = tick()
  374. local timeincrement = tick()
  375. repeat
  376. game:GetService("RunService").Heartbeat:wait()
  377. if transition == false then
  378. local delta = tick() - tid
  379. game.ReplicatedStorage.RemoteEvents.Spiderman:FireServer("WallClimbing", char.HumanoidRootPart.CFrame)
  380. Wallclimbtrack:AdjustSpeed(pushforce.Z)
  381. char.HumanoidRootPart.CFrame = (char.HumanoidRootPart.CFrame + char.HumanoidRootPart.CFrame.upVector * pushforce.Z * 14 * delta) * CFrame.Angles(0, 0, -math.pi * pushforce.X * delta)
  382. WallRotation = (WallRotation - math.pi * pushforce.X * delta) % (2 * math.pi)
  383. if math.abs(pushforce.Z) > 0.5 then
  384. local roof, roofpos, roofsurface = workspace:FindPartOnRayWithIgnoreList(Ray.new(char.HumanoidRootPart.CFrame.p, char.HumanoidRootPart.CFrame.upVector * pushforce.Z * 3), charlist)
  385. if roof == nil or roof ~= nil and roof.Transparency == 1 then
  386. local Wall, Wallpos, Wallsurface = workspace:FindPartOnRayWithIgnoreList(Ray.new(char.HumanoidRootPart.CFrame.p + char.HumanoidRootPart.CFrame.upVector * pushforce.Z * 3, -NormalVector * 2), charlist)
  387. if Wall == nil or Wall ~= nil and Wall.Transparency == 1 then
  388. local floor, pos, surface = workspace:FindPartOnRayWithIgnoreList(Ray.new(char.HumanoidRootPart.CFrame.p + char.HumanoidRootPart.CFrame.upVector * pushforce.Z * 3 - NormalVector * 3, -char.HumanoidRootPart.CFrame.upVector * pushforce.Z * 5), charlist)
  389. if surface:Dot(Vector3.new(0, 1, 0)) > 0.3 then
  390. Mode = "Idle"
  391. char.HumanoidRootPart.Velocity = Vector3.new(0, 100, 0)
  392. else
  393. transition = true
  394. TransitionSurface(char.HumanoidRootPart.CFrame, CFrame.new(pos + surface * 0.75, pos) * CFrame.Angles(0, 0, WallRotation))
  395. transition = false
  396. end
  397. end
  398. elseif roofsurface:Dot(Vector3.new(0, 1, 0)) > 0.3 then
  399. Mode = "Idle"
  400. else
  401. transition = true
  402. TransitionSurface(char.HumanoidRootPart.CFrame, CFrame.new(roofpos + roofsurface * 0.75, roofpos) * CFrame.Angles(0, 0, -WallRotation))
  403. transition = false
  404. end
  405. end
  406. end
  407. tid = tick()
  408. until Mode ~= "WallClimbing"
  409. game.ReplicatedStorage.RemoteEvents.Spiderman:FireServer("EndWallClimbing")
  410. Wallclimbtrack:Stop()
  411. Wallclimbtrack:destroy()
  412. EndWallClimb()
  413. end
  414. end
  415. local weblist = {}
  416. local function CreateWeb(character, target, armname, length)
  417. local arm = character[armname]
  418. local webpart = Instance.new("Part")
  419. webpart.Name = arm.Name .. "WebPart"
  420. webpart.Transparency = 1
  421. webpart.CanCollide = false
  422. webpart.Size = Vector3.new(0.2, 0.2, 0.2)
  423. webpart.Anchored = true
  424. webpart.Parent = character
  425. local webpart2 = Instance.new("Part")
  426. webpart2.Name = arm.Name .. "WebPart2"
  427. webpart2.Transparency = 1
  428. webpart2.CanCollide = false
  429. webpart2.Size = Vector3.new(0.2, 0.2, 0.2)
  430. webpart2.Anchored = true
  431. webpart2.CFrame = CFrame.new(target)
  432. webpart2.Parent = character
  433. local attachment2 = Instance.new("Attachment", webpart)
  434. if weblist[character] == nil then
  435. weblist[character] = {}
  436. end
  437. weblist[character][armname] = 1
  438. attachment2.Name = "WebAttachment"
  439. local attachment3 = Instance.new("Attachment", webpart2)
  440. attachment3.Name = "WebAttachment"
  441. local web = Instance.new("RopeConstraint", webpart)
  442. web.Color = BrickColor.new("Institutional white")
  443. web.Attachment0 = attachment2
  444. web.Attachment1 = attachment3
  445. web.Visible = true
  446. repeat
  447. game:GetService("RunService").Heartbeat:wait()
  448. webpart.CFrame = arm.CFrame
  449. until character.Parent ~= workspace or weblist[character] == nil or weblist[character][armname] == nil
  450. if webpart ~= nil then
  451. web:destroy()
  452. webpart:destroy()
  453. webpart2:destroy()
  454. print("Destroy part")
  455. end
  456. end
  457. local function RemoveWeb(character, arm)
  458. if weblist[character] then
  459. weblist[character][arm] = nil
  460. end
  461. end
  462. game.ReplicatedStorage.RemoteEvents.Spiderman.OnClientEvent:connect(function(mode, plr, armname, target, length)
  463. print(mode)
  464. if mode == "SwingStart" then
  465. CreateWeb(plr.Character, target, armname, length)
  466. elseif mode == "SwingEnd" then
  467. RemoveWeb(plr.Character, armname)
  468. elseif mode == "WallClimbing" then
  469. plr.Character.HumanoidRootPart.Anchored = true
  470. plr.Character.HumanoidRootPart.CFrame = armname
  471. elseif mode == "EndWallClimbing" then
  472. wait()
  473. plr.Character.HumanoidRootPart.Anchored = false
  474. end
  475. end)
  476. local function WebSling(arm, target)
  477. if Mode ~= "Fighting" then
  478. do
  479. local distance = 0
  480. local asda
  481. if auto == true then
  482. asda, target = AutoAim(arm.Name)
  483. end
  484. local direction = target - arm.Position.unit * 800
  485. local hit, pos
  486. Mode = "Slinging"
  487. local swinganim = Instance.new("Animation")
  488. swinganim.AnimationId = "rbxassetid://1040609459"
  489. local swingtrack = humanoid:LoadAnimation(swinganim)
  490. local swingendanim = Instance.new("Animation")
  491. swingendanim.AnimationId = "rbxassetid://1040639592"
  492. local swingendtrack = humanoid:LoadAnimation(swingendanim)
  493. local oldorigin = arm.Position
  494. local origin = arm.Position
  495. local tid = tick()
  496. local origtid = tick()
  497. local audio = CreateInstance("Sound", {
  498. Name = "WebSound",
  499. SoundId = "rbxassetid://1054823746"
  500. })
  501. audio.Parent = game.Soundscape
  502. audio:Play()
  503. coroutine.resume(coroutine.create(function()
  504. wait(2)
  505. audio:Stop()
  506. audio:destroy()
  507. end))
  508. local webpart = Instance.new("Part")
  509. webpart.Name = arm.Name .. "WebPart"
  510. webpart.Transparency = 1
  511. webpart.CanCollide = false
  512. webpart.Size = Vector3.new(0.2, 0.2, 0.2)
  513. webpart.Anchored = true
  514. webpart.Parent = workspace
  515. local webpart2 = Instance.new("Part")
  516. webpart2.Name = arm.Name .. "WebPart2"
  517. webpart2.Transparency = 1
  518. webpart2.CanCollide = false
  519. webpart2.Size = Vector3.new(0.2, 0.2, 0.2)
  520. webpart2.Anchored = true
  521. webpart2.Parent = workspace
  522. local attachment2 = Instance.new("Attachment", webpart)
  523. attachment2.Name = "WebAttachment"
  524. local attachment3 = Instance.new("Attachment", webpart2)
  525. attachment3.Name = "WebAttachment"
  526. local length = 0.2
  527. local web = Instance.new("RopeConstraint", webpart)
  528. web.Color = BrickColor.new("Institutional white")
  529. web.Length = webpart.Position - webpart2.Position.magnitude
  530. web.Attachment0 = attachment2
  531. web.Attachment1 = attachment3
  532. web.Visible = true
  533. repeat
  534. game:GetService("RunService").Heartbeat:wait()
  535. local delta = tick() - tid
  536. hit, pos = RayCheck(origin, direction * delta)
  537. origin = origin + direction * delta
  538. webpart.CFrame = arm.CFrame
  539. webpart2.CFrame = CFrame.new(origin)
  540. web.Length = oldorigin - webpart2.Position.magnitude
  541. if hit ~= nil and hit.Transparency == 1 then
  542. hit = nil
  543. end
  544. tid = tick()
  545. until tick() - origtid > 0.75 or hit ~= nil
  546. webpart2:destroy()
  547. if hit and webpart.Parent == workspace and Mode ~= "WallClimbing" then
  548. local distToGround = pos.Y
  549. if distToGround < 40 then
  550. distToGround = 40
  551. end
  552. swingtrack:Play(0.1, 1, 0)
  553. length = pos - oldorigin.magnitude
  554. local attachment0 = Instance.new("Attachment", arm)
  555. attachment0.Name = "WebAttachment"
  556. local attachment1 = Instance.new("Attachment", hit)
  557. attachment1.Position = hit.CFrame:pointToObjectSpace(pos)
  558. web.Attachment1 = attachment1
  559. if length > distToGround - 30 then
  560. length = (distToGround - 30) * 1.2
  561. end
  562. web.Length = length / 1.2
  563. game.ReplicatedStorage.RemoteEvents.Spiderman:FireServer("SwingStart", arm.Name, pos, length / 1.2)
  564. local gyro = CreateInstance("BodyGyro", {
  565. Name = arm.Name .. "Gyro",
  566. CFrame = CFrame.new(Vector3.new(char.HumanoidRootPart.Position.X, 0, char.HumanoidRootPart.Position.Z), Vector3.new(pos.X, 0, pos.Z)),
  567. P = 5000,
  568. D = 500,
  569. MaxTorque = Vector3.new(10000000000, 1000000000, 100000000),
  570. Parent = char.HumanoidRootPart
  571. })
  572. local vectorforce = Instance.new("VectorForce")
  573. vectorforce.Attachment0 = attachment0
  574. vectorforce.Enabled = false
  575. vectorforce.Name = arm.Name .. "Force"
  576. vectorforce.RelativeTo = "World"
  577. vectorforce.Parent = arm
  578. local pushvectorforce = Instance.new("VectorForce")
  579. pushvectorforce.Attachment0 = char.HumanoidRootPart.RootRigAttachment
  580. pushvectorforce.Enabled = true
  581. pushvectorforce.Name = "PushForce"
  582. pushvectorforce.RelativeTo = "World"
  583. pushvectorforce.Parent = char.HumanoidRootPart
  584. coroutine.resume(coroutine.create(function()
  585. repeat
  586. game:GetService("RunService").Heartbeat:wait()
  587. humanoid:ChangeState(Enum.HumanoidStateType.Physics)
  588. if arm.Position - pos.magnitude > length / 1.2 then
  589. vectorforce.Force = pos - arm.Position.unit * 50000 * (1 - pos - arm.Position.unit:Dot(char.HumanoidRootPart.Velocity.unit)) * (arm.Position - pos.magnitude - length / 1.2) / 25
  590. vectorforce.Enabled = true
  591. else
  592. vectorforce.Enabled = false
  593. end
  594. webpart.CFrame = arm.CFrame
  595. local lookatpoint = CFrame.new(arm.Position, pos)
  596. local cframe = CFrame.new(Vector3.new(0, 0, 0), -lookatpoint.upVector) + arm.Position
  597. local atan1 = math.atan2(char.HumanoidRootPart.Velocity.Z, char.HumanoidRootPart.Velocity.X)
  598. local atan2 = math.atan2(cframe.lookVector.Z, cframe.lookVector.X)
  599. local LookingCFrame = cframe * CFrame.Angles(0, atan2 - atan1, 0)
  600. if pushforce.magnitude > 0.5 then
  601. local atan1 = math.atan2(workspace.CurrentCamera.CFrame.lookVector.Z, workspace.CurrentCamera.CFrame.lookVector.X)
  602. local LookingCFrame = cframe * CFrame.Angles(0, atan2 - atan1, 0)
  603. pushvectorforce.Force = LookingCFrame:pointToWorldSpace(Vector3.new(pushforce.X, pushforce.Y, -pushforce.Z)) - LookingCFrame.p.unit * 3000
  604. else
  605. pushvectorforce.Force = Vector3.new(0, 0, 0)
  606. end
  607. gyro.CFrame = LookingCFrame
  608. local timestep = char.HumanoidRootPart.Velocity.unit.Y
  609. if char.HumanoidRootPart.Velocity.unit.Y < -0.45 then
  610. timestep = -0.45
  611. elseif char.HumanoidRootPart.Velocity.unit.Y > 0.45 then
  612. timestep = 0.45
  613. end
  614. if timestep - (swingtrack.TimePosition - 0.5) > 0.15 then
  615. timestep = swingtrack.TimePosition - 0.5 + 0.15
  616. elseif timestep - (swingtrack.TimePosition - 0.5) < -0.15 then
  617. timestep = swingtrack.TimePosition - 0.5 - 0.15
  618. end
  619. swingtrack.TimePosition = 0.5 + timestep
  620. until vectorforce.Parent ~= arm
  621. game.ReplicatedStorage.RemoteEvents.Spiderman:FireServer("SwingEnd", arm.Name)
  622. swingtrack:Stop()
  623. swingtrack:destroy()
  624. if swingtrack.TimePosition > 0.925 then
  625. local oppositearm = char.RightHand
  626. if arm.Name == "RightHand" then
  627. oppositearm = char.LeftHand
  628. end
  629. if oppositearm:FindFirstChild(oppositearm.Name .. "Force") == nil then
  630. swingendtrack:Play(0.1)
  631. wait(0.25)
  632. swingendtrack:Stop(0.6)
  633. swingendtrack:destroy()
  634. end
  635. end
  636. end))
  637. end
  638. end
  639. end
  640. end
  641. function EndWebsling(arm)
  642. local oppositearm = char.RightHand
  643. if arm.Name == "RightHand" then
  644. oppositearm = char.LeftHand
  645. end
  646. if oppositearm:FindFirstChild(oppositearm.Name .. "Force") == nil and Mode ~= "WallClimbing" then
  647. Mode = "Idle"
  648. print(Mode)
  649. end
  650. if arm:FindFirstChild("WebAttachment") then
  651. arm:FindFirstChild(arm.Name .. "Force"):destroy()
  652. arm.WebAttachment:Destroy()
  653. end
  654. workspace[arm.Name .. "WebPart"]:destroy()
  655. if char.HumanoidRootPart:FindFirstChild(arm.Name .. "Gyro") then
  656. char.HumanoidRootPart:FindFirstChild(arm.Name .. "Gyro"):destroy()
  657. char.HumanoidRootPart:FindFirstChild("PushForce"):destroy()
  658. end
  659. end
  660. local function DefaultAttack(point)
  661. print("Punching!")
  662. if Mode == "Idle" and AtkDebounce == false and interaction == nil then
  663. Mode = "Fighting"
  664. local target = point
  665. AtkDebounce = true
  666. local gyro
  667. local targetnum = 10
  668. local targetmob
  669. local anim = Instance.new("Animation")
  670. local num = math.random(1, 3)
  671. local position
  672. local waittime = 0.4
  673. local speed = 1.75
  674. if num == 1 then
  675. anim.AnimationId = "rbxassetid://1044296535"
  676. elseif num == 2 then
  677. waittime = 0.5
  678. anim.AnimationId = "rbxassetid://1044347256"
  679. speed = 1.75
  680. else
  681. anim.AnimationId = "rbxassetid://1044505610"
  682. waittime = 0.5
  683. speed = 1
  684. end
  685. local play = char.Humanoid:LoadAnimation(anim)
  686. play:Play(0.1, 1, speed)
  687. local humanoid = char:WaitForChild("Humanoid")
  688. target = char.HumanoidRootPart.Position + char.HumanoidRootPart.CFrame.lookVector * 18
  689. for _, v in pairs(workspace.NPCs:GetChildren()) do
  690. if v.ClassName == "Model" and v:FindFirstChild("Humanoid") and v.Humanoid.Health > 0 then
  691. local distance
  692. if point == nil then
  693. local sin, cos = FindShortestDistance(char.HumanoidRootPart.Position, char.HumanoidRootPart.Position + char.HumanoidRootPart.CFrame.lookVector, v.HumanoidRootPart.Position)
  694. if v.HumanoidRootPart.Position - (char.HumanoidRootPart.Position + workspace.CurrentCamera.CFrame * CFrame.Angles(0, ThumbstickDir - math.pi / 2, 0).lookVector * cos).magnitude < v.HumanoidRootPart.Position - char.HumanoidRootPart.Position.magnitude then
  695. distance = sin
  696. else
  697. distance = 9999
  698. end
  699. else
  700. distance = FindShortestDistance(char.HumanoidRootPart.Position, char.HumanoidRootPart.Position + char.HumanoidRootPart.CFrame.lookVector, v.HumanoidRootPart.Position)
  701. end
  702. local bull, sht, cos = FindShortestDistance(char.HumanoidRootPart.CFrame.p, char.HumanoidRootPart.CFrame.p + char.HumanoidRootPart.CFrame.lookVector * 10, v.HumanoidRootPart.Position)
  703. print("Cos: " .. cos)
  704. if targetnum > distance and cos ~= nil and cos > 0.1 and v.HumanoidRootPart.Position - char.HumanoidRootPart.Position.magnitude < 15 then
  705. targetnum = distance
  706. targetmob = v
  707. end
  708. end
  709. end
  710. char.HumanoidRootPart.Punch.PlaybackSpeed = 1 + math.random() * 1
  711. char.HumanoidRootPart.Punch.Volume = 0.75
  712. char.HumanoidRootPart.Punch:Play()
  713. humanoid.AutoRotate = false
  714. if targetmob ~= nil then
  715. print("Heeeeyee")
  716. local ononum = math.random(1, 3)
  717. local ononame = "Pow!"
  718. local x = math.random(1, 30)
  719. local depth = math.random(1, 10)
  720. local onopos = CFrame.new(targetmob.HumanoidRootPart.Position, char.HumanoidRootPart.Position):toWorldSpace(CFrame.new(4 * math.cos(2 * x * math.pi / 30), 2 * math.sin(2 * x * math.pi / 30) + 1, -depth / 10 - 0.5))
  721. if ononum == 1 then
  722. ononame = "Bam!"
  723. elseif ononum == 3 then
  724. ononame = "Wham!"
  725. end
  726. Onomatopoeia(ononame, onopos)
  727. game.ReplicatedStorage.RemoteEvents.Spiderman:FireServer("DefaultAttack", {
  728. target = targetmob,
  729. name = ononame,
  730. pos = onopos,
  731. animnum = num
  732. })
  733. end
  734. wait(waittime)
  735. AtkDebounce = false
  736. Mode = "Idle"
  737. humanoid.WalkSpeed = 16
  738. humanoid.AutoRotate = true
  739. end
  740. end
  741. local function UltimateActivate()
  742. if UltActive == false and interaction == nil and (_G.lastUlt == nil or _G.lastUlt ~= nil and tick() - _G.lastUlt > 30) then
  743. UltActive = true
  744. UltDebounce = true
  745. print("ActivateUlt")
  746. local humanoid = char:WaitForChild("Humanoid")
  747. local num = 1
  748. local anim = Instance.new("Animation")
  749. anim.AnimationId = "rbxassetid://1046029730"
  750. local play = humanoid:LoadAnimation(anim)
  751. local anim = Instance.new("Animation")
  752. anim.AnimationId = "rbxassetid://1046143909"
  753. local play2 = humanoid:LoadAnimation(anim)
  754. local walkspeed = humanoid.WalkSpeed
  755. _G.lastUlt = tick()
  756. humanoid.WalkSpeed = 0
  757. humanoid.AutoRotate = false
  758. local tid = tick()
  759. local gyro = CreateInstance("BodyGyro", {
  760. P = 10000000000000000,
  761. D = 100000000,
  762. MaxTorque = Vector3.new(20000, 20000, 20000),
  763. Parent = char.HumanoidRootPart
  764. })
  765. local targetted = 0
  766. local p = workspace.CurrentCamera.CFrame.p
  767. for _, v in pairs(workspace.NPCs:GetChildren()) do
  768. if v.HumanoidRootPart.Position - char.HumanoidRootPart.Position.magnitude < 40 and targetted < 9 and v.Torso:FindFirstChild("WebDecal") == nil then
  769. targetted = targetted + 1
  770. do
  771. local shot = game.ReplicatedStorage.WebShot:clone()
  772. local charcframe = char.HumanoidRootPart.CFrame.p
  773. local vcframe = v.HumanoidRootPart.CFrame.p
  774. gyro.CFrame = CFrame.new(Vector3.new(charcframe.X, 0, charcframe.Z), Vector3.new(vcframe.X, 0, vcframe.Z))
  775. local arm = char.RightHand
  776. if targetted % 2 == 0 then
  777. arm = char.LeftHand
  778. play2:Stop()
  779. play:Play()
  780. else
  781. play:Stop()
  782. play2:Play()
  783. end
  784. wait(0.2)
  785. local audio = CreateInstance("Sound", {
  786. Name = "WebSound",
  787. SoundId = "rbxassetid://1054823746"
  788. })
  789. audio.Parent = game.Soundscape
  790. audio:Play()
  791. coroutine.resume(coroutine.create(function()
  792. wait(2)
  793. audio:Stop()
  794. audio:destroy()
  795. end))
  796. shot.CFrame = arm.CFrame + Vector3.new(0, 0.25, 0)
  797. local dir = v.HumanoidRootPart.Position - shot.CFrame.p
  798. shot.Parent = workspace
  799. coroutine.resume(coroutine.create(function()
  800. local tic = tick()
  801. local tid = tick()
  802. repeat
  803. game:GetService("RunService").Heartbeat:wait()
  804. local delta = tick() - tid
  805. if 300 * delta < shot.CFrame.p - v.HumanoidRootPart.Position.magnitude then
  806. shot.CFrame = shot.CFrame + dir.unit * 300 * delta
  807. else
  808. shot.CFrame = shot.CFrame + dir.unit * shot.CFrame.p - v.HumanoidRootPart.Position.magnitude
  809. end
  810. tid = tick()
  811. until (tick() - tic) * 300 > dir.magnitude or shot.Parent ~= workspace
  812. wait(1)
  813. shot:destroy()
  814. end))
  815. wait(0.25)
  816. game.ReplicatedStorage.RemoteEvents.Spiderman:FireServer("StuckEnemy", v)
  817. end
  818. end
  819. end
  820. gyro:destroy()
  821. humanoid.WalkSpeed = 16
  822. humanoid.AutoRotate = true
  823. wait(10 - (tick() - tid))
  824. UltDebounce = false
  825. play2 = nil
  826. wait(20)
  827. UltActive = false
  828. end
  829. end
  830. local EnviromentInteraction = function()
  831. end
  832. function CheckInteractables()
  833. end
  834. UIS.TouchTap:connect(function(list, chatting)
  835. if chatting == false then
  836. DefaultAttack()
  837. end
  838. end)
  839. UIS.InputChanged:connect(function(key, processed)
  840. if key.KeyCode == Enum.KeyCode.Thumbstick1 then
  841. if key.Position.magnitude > 0.25 then
  842. local dir = math.atan2(key.Position.Y, key.Position.X) % (math.pi * 2)
  843. if dir > math.pi * 0.2 and dir < 0.8 * math.pi and input[Enum.KeyCode.W] == nil then
  844. input[Enum.KeyCode.W] = 1
  845. elseif input[Enum.KeyCode.W] ~= nil and (dir > 0.7 * math.pi or dir < math.pi * 0.2) and input[Enum.KeyCode.W] then
  846. input[Enum.KeyCode.W] = nil
  847. end
  848. if dir > math.pi * 1.2 and dir < math.pi * 1.8 and input[Enum.KeyCode.S] == nil then
  849. input[Enum.KeyCode.S] = 1
  850. elseif input[Enum.KeyCode.S] ~= nil and (dir < math.pi * 1.2 or dir > math.pi * 1.8) and input[Enum.KeyCode.S] then
  851. input[Enum.KeyCode.S] = nil
  852. end
  853. if (dir < math.pi * 0.3 or dir > math.pi * 1.7) and input[Enum.KeyCode.D] == nil then
  854. input[Enum.KeyCode.D] = 1
  855. elseif input[Enum.KeyCode.D] ~= nil and dir < math.pi * 1.7 and dir > math.pi * 0.3 and input[Enum.KeyCode.D] then
  856. input[Enum.KeyCode.D] = nil
  857. end
  858. if dir > math.pi * 0.7 and dir < math.pi * 1.3 and input[Enum.KeyCode.A] == nil then
  859. input[Enum.KeyCode.A] = 1
  860. elseif input[Enum.KeyCode.A] ~= nil and (dir > math.pi * 1.3 or dir < math.pi * 0.7) and input[Enum.KeyCode.A] then
  861. input[Enum.KeyCode.A] = nil
  862. end
  863. ThumbstickDir = dir
  864. elseif key.Position.magnitude < 0.1 then
  865. ThumbstickDir = math.pi / 2
  866. if input[Enum.KeyCode.W] then
  867. input[Enum.KeyCode.W] = nil
  868. end
  869. if input[Enum.KeyCode.A] then
  870. input[Enum.KeyCode.A] = nil
  871. end
  872. if input[Enum.KeyCode.D] then
  873. input[Enum.KeyCode.D] = nil
  874. end
  875. if input[Enum.KeyCode.S] then
  876. input[Enum.KeyCode.S] = nil
  877. end
  878. end
  879. end
  880. end)
  881. local armnumber = 1
  882. CAS:BindAction("Activate ULT", UltimateActivate, true)
  883. CAS:SetPosition("Activate ULT", UDim2.new(0.65, 0, 0.1, 0))
  884. CAS:BindAction("WebSwing", function(name, mode)
  885. if mode == Enum.UserInputState.Begin then
  886. armnumber = armnumber + 1
  887. if char.RightHand:FindFirstChild("RightHandForce") then
  888. EndWebsling(char.RightHand)
  889. end
  890. if char.LeftHand:FindFirstChild("LeftHandForce") then
  891. EndWebsling(char.LeftHand)
  892. end
  893. wait()
  894. local localarm = char.RightHand
  895. if armnumber % 2 == 0 then
  896. localarm = char.LeftHand
  897. end
  898. WebSling(localarm)
  899. elseif mode == Enum.UserInputState.End then
  900. local localarm = char.RightHand
  901. if armnumber % 2 == 0 then
  902. localarm = char.LeftHand
  903. end
  904. if char.RightHand:FindFirstChild("RightHandForce") then
  905. EndWebsling(char.RightHand)
  906. end
  907. if char.LeftHand:FindFirstChild("LeftHandForce") then
  908. EndWebsling(char.LeftHand)
  909. end
  910. end
  911. end, true)
  912. CAS:SetPosition("WebSwing", UDim2.new(0.35, 0, 0.2, 0))
  913. CAS:BindAction("WallClimb", function(name, mode)
  914. if mode == Enum.UserInputState.Begin then
  915. if CanWallclimb == true and Mode ~= "WallClimbing" and Mode ~= "Fighting" then
  916. WallClimb()
  917. elseif Mode == "WallClimbing" then
  918. Mode = "Idle"
  919. end
  920. end
  921. end, true)
  922. CAS:SetPosition("WallClimb", UDim2.new(0.2, 0, 0.55, 0))
  923. local n = 0
  924. UIS.InputBegan:connect(function(key, chatting)
  925. if chatting == false then
  926. if key.UserInputType == Enum.UserInputType.MouseButton1 or key.KeyCode == Enum.KeyCode.ButtonR2 then
  927. local point
  928. if key.UserInputType == Enum.UserInputType.MouseButton1 then
  929. point = m.Hit.p
  930. end
  931. DefaultAttack(point)
  932. end
  933. if key.KeyCode == Enum.KeyCode.F or key.KeyCode == Enum.KeyCode.ButtonB then
  934. if CanWallclimb == true and Mode ~= "WallClimbing" and Mode ~= "Fighting" then
  935. WallClimb()
  936. elseif Mode == "WallClimbing" then
  937. Mode = "Idle"
  938. end
  939. end
  940. if key.KeyCode == Enum.KeyCode.R or key.KeyCode == Enum.KeyCode.ButtonY then
  941. UltimateActivate()
  942. end
  943. if key.KeyCode == Enum.KeyCode.E or key.KeyCode == Enum.KeyCode.ButtonX or key.KeyCode == Enum.KeyCode.ButtonR1 then
  944. if key.KeyCode ~= Enum.KeyCode.ButtonR1 then
  945. spawn(function()
  946. if interaction == nil then
  947. EnviromentInteraction()
  948. else
  949. if plr.PlayerGui:FindFirstChild("MobileExitInteraction") then
  950. plr.PlayerGui:FindFirstChild("MobileExitInteraction"):destroy()
  951. end
  952. RS.RemoteEvents.Strength:FireServer(interaction.model, "EndEnviroment")
  953. end
  954. end)
  955. end
  956. if key.KeyCode ~= Enum.KeyCode.ButtonX then
  957. if char.RightHand:FindFirstChild("RightHandForce") then
  958. EndWebsling(char.RightHand)
  959. end
  960. WebSling(char.RightHand, m.Hit.p)
  961. end
  962. end
  963. if key.KeyCode == Enum.KeyCode.Q or key.KeyCode == Enum.KeyCode.ButtonL1 then
  964. if char.LeftHand:FindFirstChild("LeftHandForce") then
  965. EndWebsling(char.LeftHand)
  966. end
  967. WebSling(char.LeftHand, m.Hit.p)
  968. end
  969. if key.KeyCode == Enum.KeyCode.W or key.KeyCode == Enum.KeyCode.S or key.KeyCode == Enum.KeyCode.D or key.KeyCode == Enum.KeyCode.A then
  970. input[key.KeyCode] = 1
  971. end
  972. end
  973. end)
  974. UIS.InputEnded:connect(function(key, chatting)
  975. if chatting == false then
  976. if key.KeyCode == Enum.KeyCode.E or key.KeyCode == Enum.KeyCode.ButtonR1 then
  977. EndWebsling(char.RightHand)
  978. end
  979. if key.KeyCode == Enum.KeyCode.Q or key.KeyCode == Enum.KeyCode.ButtonL1 then
  980. EndWebsling(char.LeftHand)
  981. end
  982. if key.KeyCode == Enum.KeyCode.W or key.KeyCode == Enum.KeyCode.S or key.KeyCode == Enum.KeyCode.D or key.KeyCode == Enum.KeyCode.A then
  983. input[key.KeyCode] = nil
  984. end
  985. end
  986. end)
  987. local t = 0
  988. local LastCheckedTime = tick()
  989. char.Humanoid.StateChanged:connect(function(old, new)
  990. if new == Enum.HumanoidStateType.Landed and char.HumanoidRootPart.Velocity.Y < -250 then
  991. print("Crash land! " .. char.HumanoidRootPart.Velocity.Y)
  992. humanoid.WalkSpeed = 0
  993. humanoid.AutoRotate = false
  994. local Defaultanim = Instance.new("Animation")
  995. local charlist = {}
  996. Defaultanim.AnimationId = "rbxassetid://1042575388"
  997. local DefaultPlay = humanoid:LoadAnimation(Defaultanim)
  998. DefaultPlay:Play(0.15)
  999. wait(0.35)
  1000. DefaultPlay:Stop(0.5)
  1001. wait(0.4)
  1002. humanoid.WalkSpeed = 16
  1003. humanoid.AutoRotate = true
  1004. end
  1005. end)
  1006. game:GetService("RunService").Heartbeat:connect(function(delta)
  1007. t = t + 1
  1008. if t % 30 == 0 then
  1009. OnMobile = _G.OnMobile
  1010. OnConsole = _G.OnConsole
  1011. charlist = {}
  1012. for _, v in pairs(game.Players:GetPlayers()) do
  1013. table.insert(charlist, v.Character)
  1014. end
  1015. end
  1016. if OnMobile then
  1017. local point = plr.PlayerGui:WaitForChild("TouchGui"):WaitForChild("TouchControlFrame"):WaitForChild("ThumbstickFrame"):WaitForChild("StickImage")
  1018. local centre = plr.PlayerGui:WaitForChild("TouchGui"):WaitForChild("TouchControlFrame"):WaitForChild("ThumbstickFrame"):WaitForChild("OuterImage")
  1019. local position = Vector2.new((point.AbsolutePosition.X + point.AbsoluteSize.X / 2 - (centre.AbsolutePosition.X + centre.AbsoluteSize.X / 2)) / (centre.AbsoluteSize.X / 2), -(point.AbsolutePosition.Y + point.AbsoluteSize.Y / 2 - (centre.AbsolutePosition.Y + centre.AbsoluteSize.Y / 2)) / (centre.AbsoluteSize.Y / 2))
  1020. if position.magnitude > 0.25 then
  1021. local dir = math.atan2(position.Y, position.X) % (math.pi * 2)
  1022. if dir > math.pi * 0.2 and dir < 0.8 * math.pi and input[Enum.KeyCode.W] == nil then
  1023. input[Enum.KeyCode.W] = 1
  1024. elseif input[Enum.KeyCode.W] ~= nil and (dir > 0.7 * math.pi or dir < math.pi * 0.2) and input[Enum.KeyCode.W] then
  1025. input[Enum.KeyCode.W] = nil
  1026. end
  1027. if dir > math.pi * 1.2 and dir < math.pi * 1.8 and input[Enum.KeyCode.S] == nil then
  1028. input[Enum.KeyCode.S] = 1
  1029. elseif input[Enum.KeyCode.S] ~= nil and (dir < math.pi * 1.2 or dir > math.pi * 1.8) and input[Enum.KeyCode.S] then
  1030. input[Enum.KeyCode.S] = nil
  1031. end
  1032. if (dir < math.pi * 0.3 or dir > math.pi * 1.7) and input[Enum.KeyCode.D] == nil then
  1033. input[Enum.KeyCode.D] = 1
  1034. elseif input[Enum.KeyCode.D] ~= nil and dir < math.pi * 1.7 and dir > math.pi * 0.3 and input[Enum.KeyCode.D] then
  1035. input[Enum.KeyCode.D] = nil
  1036. end
  1037. if dir > math.pi * 0.7 and dir < math.pi * 1.3 and input[Enum.KeyCode.A] == nil then
  1038. input[Enum.KeyCode.A] = 1
  1039. elseif input[Enum.KeyCode.A] ~= nil and (dir > math.pi * 1.3 or dir < math.pi * 0.7) and input[Enum.KeyCode.A] then
  1040. input[Enum.KeyCode.A] = nil
  1041. end
  1042. ThumbstickDir = dir
  1043. elseif position.magnitude < 0.1 then
  1044. ThumbstickDir = math.pi / 2
  1045. if input[Enum.KeyCode.W] then
  1046. input[Enum.KeyCode.W] = nil
  1047. end
  1048. if input[Enum.KeyCode.A] then
  1049. input[Enum.KeyCode.A] = nil
  1050. end
  1051. if input[Enum.KeyCode.D] then
  1052. input[Enum.KeyCode.D] = nil
  1053. end
  1054. if input[Enum.KeyCode.S] then
  1055. input[Enum.KeyCode.S] = nil
  1056. end
  1057. end
  1058. end
  1059. if input[Enum.KeyCode.W] ~= nil and input[Enum.KeyCode.S] == nil then
  1060. pushforce = Vector3.new(pushforce.X, 0, 1)
  1061. elseif input[Enum.KeyCode.S] ~= nil and input[Enum.KeyCode.W] == nil then
  1062. pushforce = Vector3.new(pushforce.X, 0, -1)
  1063. else
  1064. pushforce = Vector3.new(pushforce.X, 0, 0)
  1065. end
  1066. if input[Enum.KeyCode.D] ~= nil and input[Enum.KeyCode.A] == nil then
  1067. pushforce = Vector3.new(1, 0, pushforce.Z)
  1068. elseif input[Enum.KeyCode.A] ~= nil and input[Enum.KeyCode.D] == nil then
  1069. pushforce = Vector3.new(-1, 0, pushforce.Z)
  1070. else
  1071. pushforce = Vector3.new(0, 0, pushforce.Z)
  1072. end
  1073. if humanoid:GetState() == Enum.HumanoidStateType.Physics and Mode ~= "Slinging" then
  1074. humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
  1075. end
  1076. if 0.2 <= tick() - LastCheckedTime then
  1077. local hit, pos, normal = workspace:FindPartOnRayWithIgnoreList(Ray.new(char.HumanoidRootPart.CFrame.p, char.HumanoidRootPart.CFrame.lookVector * 10), charlist)
  1078. if hit == nil then
  1079. hit, pos, normal = workspace:FindPartOnRayWithIgnoreList(Ray.new(char.HumanoidRootPart.CFrame.p, -char.HumanoidRootPart.CFrame.lookVector * 10), charlist)
  1080. if hit == nil then
  1081. hit, pos, normal = workspace:FindPartOnRayWithIgnoreList(Ray.new(char.HumanoidRootPart.CFrame.p, -char.HumanoidRootPart.CFrame.rightVector * 10), charlist)
  1082. if hit == nil then
  1083. hit, pos, normal = workspace:FindPartOnRayWithIgnoreList(Ray.new(char.HumanoidRootPart.CFrame.p, char.HumanoidRootPart.CFrame.rightVector * 10), charlist)
  1084. end
  1085. end
  1086. end
  1087. if hit and hit.Size.magnitude > 25 and 1 > hit.Transparency then
  1088. CanWallclimb = true
  1089. NormalVector = normal
  1090. else
  1091. CanWallclimb = false
  1092. end
  1093. CheckInteractables()
  1094. end
  1095. if _G.lastUlt ~= nil then
  1096. if 30 >= tick() - _G.lastUlt then
  1097. plr.PlayerGui.UltCountdown.Frame.Visible = true
  1098. plr.PlayerGui.UltCountdown.Frame.Countdown.Text = tostring(math.abs(30 - math.floor(tick() - _G.lastUlt)))
  1099. plr.PlayerGui.UltCountdown.Frame.Countdown.Countdown.Text = tostring(math.abs(30 - math.floor(tick() - _G.lastUlt)))
  1100. elseif 30 < tick() - _G.lastUlt and plr.PlayerGui.UltCountdown.Frame.Visible == true then
  1101. plr.PlayerGui.UltCountdown.Frame.Visible = false
  1102. end
  1103. end
  1104. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement