HuyEvilDumb

Tower Battle: Commando Tower

Jun 23rd, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Made by QehNoob.
  2. local Player = game:GetService("Players").LocalPlayer
  3. local Character = Player.Character
  4. local Mouse = Player:GetMouse()
  5. --Mouse.TargetFilter = workspace
  6.  
  7. local Head = Character:WaitForChild("Head")
  8. local Torso = Character:WaitForChild("Torso")
  9. local RootPart = Character:WaitForChild("HumanoidRootPart")
  10. local Human = Character:WaitForChild("Humanoid")
  11.  
  12. Human.AutoRotate = false
  13. Human.JumpPower = 0
  14. Human.WalkSpeed = 10
  15. ---------------------------rekt cloths
  16. for _,v in pairs(Character:children()) do
  17. if v:IsA("Shirt") then
  18. v.ShirtTemplate = "rbxassetid://"
  19. elseif v:IsA("Pants") then
  20. v.PantsTemplate = "rbxassetid://"
  21. elseif v:IsA("ShirtGraphic") then
  22. v:Remove()
  23. wait(.1)
  24. Torso.roblox:Remove()
  25. elseif v:IsA("Accessory") then
  26. v:Remove()
  27. end
  28. end
  29.  
  30. -----------------------------------------------------------------------------------------------------------------------
  31. Character = game.Players.LocalPlayer.Character
  32. Player = game.Players.LocalPlayer
  33. char = Character
  34. hum = Character.Humanoid
  35. Torso = Character.Torso
  36. Head = Character.Head
  37.  
  38.  
  39. local BC = char["Body Colors"]
  40. BC.HeadColor = BrickColor.new("Pastel brown")
  41. BC.LeftArmColor = BrickColor.new("Pastel brown")
  42. BC.LeftLegColor = BrickColor.new("Bright red")
  43. BC.RightArmColor = BrickColor.new("Pastel brown")
  44. BC.RightLegColor = BrickColor.new("Bright red")
  45. BC.TorsoColor = BrickColor.new("Bright red")
  46.  
  47. char.Head.face.Texture = "rbxassetid://701379058"
  48.  
  49. hum.MaxHealth = math.huge
  50.  
  51.  
  52.  
  53.  
  54. for i,v in pairs(char:children()) do
  55. if v:IsA("Hat") then
  56. v:Destroy()
  57. end
  58. end
  59. for i,v in pairs(char:children()) do
  60. if v:IsA("Accessory") then
  61. v:Destroy()
  62. end
  63. end
  64. for i,v in pairs(char:children()) do
  65. if v:IsA("Hair") then
  66. v:Destroy()
  67. end
  68. end
  69. Reaper = Instance.new("Model")
  70. Reaper.Parent = Player.Character
  71. Reaper.Name = "Reaper"
  72. rh = Instance.new("Part")
  73. rh.Parent = Reaper
  74. rh.BrickColor = BrickColor.new("Really red")
  75. rh.Locked = true
  76. rh.CanCollide = false
  77. mesh = Instance.new("SpecialMesh")
  78. rh.formFactor = "Symmetric"
  79. mesh.MeshType = "FileMesh"
  80. mesh.MeshId = "http://www.roblox.com/asset/?id=9253927"
  81. mesh.TextureId = "http://www.roblox.com/asset/?id=10130613"
  82. mesh.Parent = rh
  83. mesh.Scale = Vector3.new(1.1,1.1,1.1)
  84. local weld = Instance.new("Weld")
  85. weld.Parent = rh
  86. rh.Transparency = 0
  87. weld.Part0 = rh
  88. weld.Part1 = Player.Character.Head
  89. weld.C0 = CFrame.new(-0, -0.05, -0)*CFrame.Angles(0, 0, 0)
  90.  
  91. Character:WaitForChild("Animate"):Destroy()
  92.  
  93. local RJ = RootPart:WaitForChild("RootJoint")
  94. RJ:Destroy()
  95. RJ = Instance.new("Weld", RootPart)
  96. RJ.Part0 = RootPart
  97. RJ.Part1 = Torso
  98.  
  99. local Neck = Instance.new("Weld", Torso)
  100. Neck.Part0 = Torso
  101. Neck.Part1 = Character:WaitForChild("Head")
  102. Neck.C0 = CFrame.new(0, 1.5, 0)
  103.  
  104. Torso:WaitForChild("Right Shoulder").Part1 = nil
  105. local RS = Instance.new("Weld", Head)
  106. RS.Part0 = Head
  107. RS.Part1 = Character:WaitForChild("Right Arm")
  108.  
  109. Torso:WaitForChild("Left Shoulder").Part1 = nil
  110. local LS = Instance.new("Weld", Head)
  111. LS.Part0 = Head
  112. LS.Part1 = Character:WaitForChild("Left Arm")
  113.  
  114. local LH = Torso:WaitForChild("Left Hip")
  115. LH:Destroy()
  116. LH = Instance.new("Weld", Torso)
  117. LH.Part0 = Torso
  118. LH.Part1 = Character:WaitForChild("Left Leg")
  119.  
  120. local RH = Torso:WaitForChild("Right Hip")
  121. RH:Destroy()
  122. RH = Instance.new("Weld", Torso)
  123. RH.Part0 = Torso
  124. RH.Part1 = Character:WaitForChild("Right Leg")
  125.  
  126. local GUN = Instance.new("Part", Character)
  127. GUN.CanCollide = false
  128. GUN.Size = Vector3.new(1.549, 2.302, 3.814)
  129. GUN.Name = "Handle"
  130. GUN.Material = Enum.Material.SmoothPlastic
  131.  
  132. local MS = Instance.new("SpecialMesh", GUN)
  133. MS.MeshType = Enum.MeshType.FileMesh
  134. MS.MeshId = "rbxassetid://450812185"
  135. MS.TextureId = "rbxassetid://450812194"
  136.  
  137. local GRIP = Instance.new("Weld", RS.Part1)
  138. GRIP.Part0 = RS.Part1
  139. GRIP.Part1 = GUN
  140.  
  141. local SN = Instance.new("Sound", GUN)
  142. SN.SoundId = "rbxassetid://341294387"
  143. SN.PlaybackSpeed = 0.9
  144. SN.Looped = true
  145. SN.Volume = 0
  146. SN:Play()
  147.  
  148. local FL = Instance.new("Part", GUN)
  149. FL.BrickColor = BrickColor.Yellow()
  150. FL.Transparency = 1
  151. FL.Material = Enum.Material.SmoothPlastic
  152. FL.CanCollide = false
  153. FL.Size = Vector3.new(1, 3.38, 1)
  154.  
  155. local MS2 = Instance.new("SpecialMesh", FL)
  156. MS2.MeshType = Enum.MeshType.FileMesh
  157. MS2.MeshId = "rbxassetid://1323306"
  158. MS2.Scale = Vector3.new(0.35, 1.9, 0.35)
  159.  
  160. local FLW = Instance.new("Weld", GUN)
  161. FLW.Part0 = GUN
  162. FLW.Part1 = FL
  163. FLW.C0 = CFrame.new(0.293, 0.251, 3.221, 0, 0.028, 1, 1, 0, 0, 0, 1, -0.028)
  164.  
  165. -----------------------------------------------------------------------------------------------------------------------
  166.  
  167. local STANCE = {
  168. NK = CFrame.new(0, 1, 0, 0.747311652, 0, 0.664473772, 0, 1, 0, -0.664473772, 0, 0.747311652);
  169. RJ = CFrame.new(0, 0, 0, 0.747311592, 0, -0.664473712, 0, 1, 0, 0.664473712, 0, 0.747311592);
  170. LS = CFrame.new(0.474761963, -1.61745477, -1.20455933, -0.127145067, -0.88503027, -0.447834671, -0.836402416, 0.338357687, -0.431213528, 0.533165276, 0.319743276, -0.783262014);
  171. RS = CFrame.new(1.14480591, -1.47239065, 0.695491791, 0.972185493, -0.190045089, -0.136889026, 0.123703048, 0.912935674, -0.388903707, 0.198880106, 0.361152887, 0.911051929);
  172. GRIP = CFrame.new(-0.0976009369, -1.92251587, -1.31733322, -0.980839312, 0.117544398, -0.155363142, 0.158846945, 0.944226265, -0.288452089, 0.11279203, -0.307604104, -0.944805682);
  173. }
  174.  
  175. LS.C0 = STANCE.LS
  176. RS.C0 = STANCE.RS
  177. RJ.C0 = STANCE.RJ
  178. GRIP.C0 = STANCE.GRIP
  179.  
  180. local Down = false
  181.  
  182. Mouse.Button1Down:Connect(function()
  183. Down = true
  184. end)
  185.  
  186. Mouse.Button1Up:Connect(function()
  187. Down = false
  188. end)
  189.  
  190. math.randomseed(os.time())
  191.  
  192. local function Taunt()
  193. local Taunts = {137542750, 130774824, 130776108, 679798995, 679798810}
  194. local Sound = Instance.new("Sound", GUN)
  195. local Id = Taunts[math.random(#Taunts)]
  196. Sound.TimePosition = Id == 130776108 and 4.2 or 0
  197. Sound.SoundId = "rbxassetid://" .. Id
  198. Sound.Volume = 1
  199. Sound.Ended:Connect(function()
  200. Sound:Destroy()
  201. end)
  202. Sound:Play()
  203. end
  204.  
  205. Mouse.KeyDown:Connect(function(Key)
  206. if Key == string.char(32) then
  207. Taunt()
  208. end
  209. end)
  210.  
  211.  
  212.  
  213. local function Shoot()
  214. local Bullet = Instance.new("Part")
  215. Bullet.Size = Vector3.new(0.3, 0.3, 0.7)
  216. Bullet.Transparency = 1
  217. Bullet.CanCollide = false
  218.  
  219. local AntiGravity = Instance.new("BodyForce", Bullet)
  220. AntiGravity.Force = Vector3.new(0, Bullet:GetMass() * workspace.Gravity, 0)
  221.  
  222. local Start = (GUN.CFrame * CFrame.new(0.255, 0.251, 1.877)).p
  223. Bullet.CFrame = CFrame.new(Start, Mouse.Hit.p)
  224. Bullet.Velocity = Bullet.CFrame.lookVector * 300
  225.  
  226. Bullet.Touched:Connect(function(Hit)
  227. if Hit.Parent and Hit.Parent ~= Character and Hit.Parent:FindFirstChild("Humanoid") then
  228. Hit.Parent.Humanoid:TakeDamage(5)
  229. Bullet:Destroy()
  230. end
  231. end)
  232.  
  233. Bullet.Parent = workspace
  234. game.Debris:AddItem(Bullet, 3)
  235. end
  236.  
  237.  
  238. game:GetService("RunService"):BindToRenderStep("Invisible", Enum.RenderPriority.Character.Value - 1, function()
  239. GUN.LocalTransparencyModifier = 0
  240. FL.LocalTransparencyModifier = 0
  241. LS.Part1.LocalTransparencyModifier = 0
  242. RS.Part1.LocalTransparencyModifier = 0
  243. end)
  244.  
  245. local Heartbeat, Angle = game:GetService("RunService").Heartbeat
  246.  
  247. while Heartbeat:Wait() do
  248. local Angle = tick() * 8
  249.  
  250. -- Torso lean
  251. local VelocityForTilt = RootPart.Velocity * Vector3.new(1, 0, 1) / 150
  252. local VectorForTilt = RootPart.CFrame:vectorToObjectSpace(VelocityForTilt)
  253. RJ.C0 = RJ.C0:Lerp(STANCE.RJ * CFrame.Angles(VectorForTilt.Z, VectorForTilt.X, -VectorForTilt.X), 0.1)
  254.  
  255. -- Rotate to face camera
  256. local RootPosition = RootPart.Position
  257. local Direction = Mouse.Hit.p - RootPosition
  258. Direction = Vector3.new(Direction.X, 0, Direction.Z).unit
  259. local NewCFrame = CFrame.new(RootPosition, RootPosition + Direction) * CFrame.Angles(0, -0.02, 0)
  260. RootPart.CFrame = RootPart.CFrame:Lerp(NewCFrame, 0.1)
  261.  
  262. -- Neck Angle
  263. local Hypotenuse = (Mouse.Hit.p - Head.Position).magnitude
  264. local Opposite = Mouse.Hit.p.y - Head.Position.y
  265. local Pitch = math.asin(Opposite / Hypotenuse)
  266. local NewNeckCFrame = STANCE.NK * CFrame.Angles(Pitch + 0.2, 0, 0) * CFrame.new(0, 0.5, 0)
  267. Neck.C0 = Neck.C0:Lerp(NewNeckCFrame, 0.1)
  268.  
  269. -- Legs
  270. local FlatVelocity = (Torso.Velocity * Vector3.new(1, 0, 1))
  271. if FlatVelocity.magnitude < 2 then
  272. LH.C0 = LH.C0:Lerp(CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.sin(tick() * 0.5) / 17, 0, -0.02 + math.sin(tick() * 0.4) / 19) * CFrame.new(0, -1, 0), 0.2)
  273. RH.C0 = RH.C0:Lerp(CFrame.new(0.5, -1, 0) * CFrame.Angles(math.sin(-tick() * 0.5) / 18, 0, 0.02 + math.sin(-tick() * 0.35) / 20) * CFrame.new(0, -1, 0), 0.2)
  274. else
  275. local Look = (Torso.CFrame.lookVector * Vector3.new(1, 0, 1)).unit
  276. local Move = FlatVelocity.unit
  277. local OffAngle = (Look:Cross(Move).Y > 0 and 1 or -1) * math.acos(1 - (Look - Move).magnitude ^ 2 / 2)
  278. OffAngle = math.max(-math.pi, math.min(math.pi, OffAngle))
  279. LH.C0 = LH.C0:Lerp(CFrame.new(-0.5, 0, 0) * CFrame.Angles(0, OffAngle, 0)
  280. * CFrame.new(0, -math.max(0, math.cos(Angle * 2) / 5) + math.max(0, math.cos(Angle + math.pi) / 2.5) - 2, math.sin(-Angle + math.pi) / 1.8 + 0.15)
  281. * CFrame.Angles(math.sin(-Angle) / 1.8 - 0.2, 0, 0), 0.2)
  282. RH.C0 = RH.C0:Lerp(CFrame.new(0.5, 0, 0) * CFrame.Angles(0, OffAngle, 0)
  283. * CFrame.new(0, -math.max(0, math.cos(Angle * 2) / 5) + math.max(0, math.cos(Angle) / 2.5) - 2, math.sin(-Angle) / 1.8 + 0.15)
  284. * CFrame.Angles(math.sin(Angle) / 1.8 - 0.2, 0, 0), 0.2)
  285. end
  286.  
  287. -- Shooting
  288. if Down then
  289. SN.Volume = SN.Volume + (1.5 - SN.Volume) * 0.3
  290. FL.Transparency = FL.Transparency + (0.6 - FL.Transparency) * 0.2
  291. FLW.C0 = FLW.C0 * CFrame.Angles(0, 0.2, 0)
  292. Shoot()
  293. else
  294. SN.Volume = SN.Volume + (0 - SN.Volume) * 0.15
  295. FL.Transparency = FL.Transparency + (1 - FL.Transparency) * 0.2
  296. end
  297. end
Advertisement
Add Comment
Please, Sign In to add comment