Advertisement
Puppet213321

dwdd

Jun 8th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.14 KB | None | 0 0
  1. -- Initial stuff
  2. math.randomseed(tick())
  3.  
  4.  
  5. -- Wait for character
  6. repeat wait() until game.Players.LocalPlayer.Character ~= nil
  7.  
  8.  
  9. -- Useful shortcuts
  10. local plr = game:GetService("Players").LocalPlayer
  11. local char = plr.Character
  12. local plrgui = plr.PlayerGui
  13. local backpack = plr.Backpack
  14. local torso = char.Torso
  15. local head = char.Head
  16. local hum = char.Humanoid
  17. local larm = char["Left Arm"]
  18. local lleg = char["Left Leg"]
  19. local rarm = char["Right Arm"]
  20. local rleg = char["Right Leg"]
  21. local LS = torso["Left Shoulder"]
  22. local LH = torso["Left Hip"]
  23. local RS = torso["Right Shoulder"]
  24. local RH = torso["Right Hip"]
  25. local neck = torso.Neck
  26. local it = Instance.new
  27. local vt = Vector3.new
  28. local cf = CFrame.new
  29. local euler = CFrame.fromEulerAnglesXYZ
  30. local angles = CFrame.Angles
  31. local neckC0 = cf(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  32. local neckC1 = cf(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  33. local LSC0 = cf(-1.5,.5,0)
  34. local LSC1 = cf(0,.5,0)
  35. local RSC0 = cf(1.5,.5,0)
  36. local RSC1 = cf(0,.5,0)
  37. local LHC0 = cf(-1,-1,0,-0,-0,-1,0,1,0,1,0,0)
  38. local LHC1 = cf(-0.5,1,0,-0,-0,-1,0,1,0,1,0,0)
  39. local RHC0 = cf(1,-1,0,0,0,1,0,1,0,-1,-0,-0)
  40. local RHC1 = cf(0.5,1,0,0,0,1,0,1,0,-1,-0,-0)
  41. local RP = char.HumanoidRootPart
  42. local RJ = RP.RootJoint
  43. local RJC0 = euler(-1.57,0,3.14)
  44.  
  45.  
  46. -- Build the weapon
  47. local build = function()
  48. local model = Instance.new("Model")
  49. model.Name = "Cane"
  50. local handle = Instance.new("Part", model)
  51. handle.FormFactor = Enum.FormFactor.Symmetric
  52. handle.CanCollide = false
  53. handle.Size = Vector3.new(2,2,6)
  54. handle.Name = "Handle"
  55. local mesh = Instance.new("SpecialMesh",handle)
  56. mesh.Scale = Vector3.new(2.9,2.9,2.9)
  57. mesh.MeshId = "http://www.roblox.com/asset/?id=419221487"
  58. mesh.TextureId = "http://www.roblox.com/asset/?id=419221538"
  59. mesh.MeshType = Enum.MeshType.FileMesh
  60. return model
  61. end
  62.  
  63.  
  64. -- Wait for mouse
  65. local mouse
  66. while true do
  67. mouse = plr:GetMouse()
  68. if mouse then break end
  69. wait(.1)
  70. end
  71.  
  72.  
  73. -- Create welds
  74. local RW, LW = Instance.new("Weld",torso), Instance.new("Weld",torso)
  75. RW.Name = "Right Weld" LW.Name = "Left Weld"
  76. RW.Part0 = torso LW.Part0 = torso
  77. RW.C0 = RSC0 RW.C1 = RSC1 LW.C0 = LSC0 LW.C1 = LSC1
  78.  
  79.  
  80. -- Attach weapon
  81. local canemodel = build()
  82. local cane = canemodel:FindFirstChild("Handle")
  83. canemodel.Parent = char
  84. local caneweld = Instance.new("Weld", rarm)
  85. caneweld.Part0 = rarm
  86. caneweld.Part1 = cane
  87. caneweldC0 = caneweld.C0 * CFrame.new(0,-1,1) * CFrame.Angles(math.rad(180),0,math.rad(90))
  88. caneweld.C0 = caneweldC0
  89.  
  90.  
  91. -- Weapon variables
  92. local caneEnd = cf(-.225,0,-1.5)
  93.  
  94.  
  95. -- Sound effects
  96. local sounds = {}
  97. sounds.explosion = "http://www.roblox.com/asset/?id=1542642349"
  98. sounds.bewm = "http://www.roblox.com/asset/?id=0"
  99. sounds.slice = "http://www.roblox.com/asset/?id=1542642349"
  100. sounds.charge = "http://roblox.com/asset/?id=1542642349"
  101. sounds.sharpblast = "http://roblox.com/asset/?id=1542642349"
  102. sounds.woosh = "http://roblox.com/asset/?id=1542642349"
  103. sounds.metalhit = "http://roblox.com/asset/?id=0"
  104. sounds.mechblast = "http://roblox.com/asset/?id=1542642349"
  105. sounds.chargepulse = "http://roblox.com/asset/?id=1542642349"
  106. sounds.heal = "http://roblox.com/asset/?id=1542642349"
  107. sounds.zap = "http://roblox.com/asset/?id=0"
  108. sounds.powernote = "http://roblox.com/asset/?id=1542642349"
  109. sounds.swing = "http://roblox.com/asset/?id=1542642349"
  110. sounds.hit = "http://roblox.com/asset/?id=0"
  111.  
  112.  
  113. -- Base functions
  114. local wait = function(t)
  115. if t ~= nil then
  116. return wait(t)
  117. else
  118. local t = tick()
  119. game:GetService("RunService").RenderStepped:wait()
  120. return tick() - t, time()
  121. end
  122. end
  123. local nolines = function(p)
  124. p.TopSurface, p.BottomSurface, p.LeftSurface, p.RightSurface, p.FrontSurface, p.BackSurface = 10, 10, 10, 10, 10, 10
  125. end
  126. local part = function(formfactor,parent,reflectance,transparency,brickcolor,name,size)
  127. local fp = it("Part")
  128. fp.formFactor = formfactor
  129. fp.Parent = parent
  130. fp.Reflectance = reflectance
  131. fp.Transparency = transparency
  132. fp.CanCollide = false
  133. fp.Locked = true
  134. fp.BrickColor = brickcolor
  135. fp.Name = name
  136. fp.Size = size
  137. fp.Position = torso.Position
  138. fp.Material = "SmoothPlastic"
  139. fp:BreakJoints()
  140. nolines(fp)
  141. return fp
  142. end
  143. local mesh = function(instance,part,meshtype,meshid,offset,scale)
  144. local mesh = it(instance)
  145. mesh.Parent = part
  146. if instance == "SpecialMesh" then
  147. mesh.MeshType = meshtype
  148. if meshid ~= nil then
  149. mesh.MeshId = "http://www.roblox.com/asset/?id="..meshid
  150. end
  151. end
  152. mesh.Offset=offset
  153. mesh.Scale=scale
  154. return mesh
  155. end
  156. local weld = function(parent,part0,part1,c0)
  157. local weld = it("Weld")
  158. weld.Parent = parent
  159. weld.Part0 = part0
  160. weld.Part1 = part1
  161. weld.C0 = c0
  162. return weld
  163. end
  164. local rayCast = function(Pos, Dir, Max, Ignore) -- Origin Position , Direction, MaxDistance , IgnoreDescendants
  165. return game:service("Workspace"):FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999.999)), Ignore)
  166. end
  167. local rad = function(x,y,z)
  168. return euler(math.rad(x or 0),math.rad(y or 0),math.rad(z or 0))
  169. end
  170. local random = function(a, b)
  171. local num = math.random(a*100, b*100)
  172. return num/100
  173. end
  174. local randomRot = function()
  175. return rad(random(0,360),random(0,360),random(0,360))
  176. end
  177. local sound = function(id, par, vol, pit)
  178. coroutine.resume(coroutine.create(function()
  179. local sou = Instance.new("Sound", par or workspace)
  180. sou.Volume = vol
  181. --sou.Pitch = pit or 1
  182. sou.SoundId = id
  183. wait()
  184. sou:play()
  185. game:GetService("Debris"):AddItem(sou, 6)
  186. end))
  187. end
  188. local damage = function(hit, minim, maxim, knockback, Type, Property, Delay, KnockbackType, incstun, stagger, staghit, ranged)
  189. -- Fen's nasty and messy damage function
  190. if hit.Parent == nil then
  191. return
  192. end
  193. local h = hit.Parent:FindFirstChild("Humanoid")
  194. for _, v in pairs(hit.Parent:children()) do
  195. if v:IsA("Humanoid") then
  196. h = v
  197. end
  198. end
  199. if hit.Parent.Parent:FindFirstChild("Torso") ~= nil then
  200. h = hit.Parent.Parent:FindFirstChild("Humanoid")
  201. end
  202. if hit.Parent.className == "Hat" then
  203. hit = hit.Parent.Parent:findFirstChild("Head")
  204. end
  205. if h ~= nil and hit.Parent.Name ~= char.Name and hit.Parent:FindFirstChild("Torso") ~= nil then
  206. if hit.Parent:findFirstChild("DebounceHit") ~= nil then
  207. if hit.Parent.DebounceHit.Value == true then
  208. return
  209. end
  210. end
  211. local c = Instance.new("ObjectValue")
  212. c.Name = "creator"
  213. c.Value = game:service("Players").LocalPlayer
  214. c.Parent = h
  215. game:GetService("Debris"):AddItem(c, .5)
  216. local Damage = 666 --random(minim, maxim)
  217. local blocked = false
  218. local enblock = nil
  219. local Stats = hit.Parent:findFirstChild("Stats")
  220. if Stats ~= nil then
  221. enblock = Stats:findFirstChild("Block")
  222. if Stats:findFirstChild("Defense") ~= nil then
  223. Damage = Damage / Stats.Defense.Value
  224. end
  225. if Stats:findFirstChild("Stun") ~= nil then
  226. Stats.Stun.Value = Stats.Stun.Value + incstun
  227. end
  228. if Stats:findFirstChild("Stagger") ~= nil then
  229. if stagger == true then
  230. Stats.Stagger.Value = true
  231. end
  232. end
  233. end
  234. if enblock ~= nil then
  235. if enblock.Value == true then
  236. blocked = true
  237. end
  238. end
  239. if blocked == true then
  240. if ranged ~= true then
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement