Advertisement
Guest User

Untitled

a guest
May 27th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 KB | None | 0 0
  1. function SpawnWeapon()
  2. local player = game.Players.LocalPlayer
  3. local wep = game.ReplicatedStorage:FindFirstChild("Fallen King")
  4. local weapon = wep:Clone()
  5. weapon.Parent = player.Character
  6. weapon.Name = "BreakingSword"
  7. local parts = player.Character:GetChildren()
  8. local wparts = weapon:GetChildren()
  9. for g = 1, #wparts do
  10. if wparts[g]:IsA("Part") or wparts[g]:IsA("UnionOperation") or wparts[g]:IsA("MeshPart") then
  11. wparts[g].Transparency = wparts[g].Transparency + 1
  12. end
  13. end
  14. for i = 1, #parts do
  15. if parts[i]:IsA("MeshPart") then
  16. for q = 1, #wparts do
  17. if wparts[q].Name == parts[i].Name then
  18. wparts[q].CFrame = parts[i].CFrame
  19. local Y = Instance.new("Weld")
  20. Y.Part0 = parts[i]
  21. Y.Part1 = wparts[q]
  22. Y.C0 = CFrame.new(0, 0, 0)
  23. Y.Parent = Y.Part0
  24. end
  25. end
  26. end
  27. end
  28. local animTrack = player.Character.Humanoid:LoadAnimation(weapon.Animation)
  29. animTrack:Play()
  30. weapon.PARTICLES.Particle.Enabled = true
  31. weapon.Damager.Glow:Play()
  32. wait(0.2)
  33. weapon.PARTICLES.Particle.Enabled = false
  34. wait(0.25)
  35. for g = 1, #wparts do
  36. if wparts[g]:IsA("Part") or wparts[g]:IsA("UnionOperation") or wparts[g]:IsA("MeshPart") then
  37. wparts[g].Transparency = wparts[g].Transparency - 1
  38. end
  39. end
  40. wait(0.35)
  41. weapon.Damager.Sound1:Play()
  42. wait(0.15)
  43. end
  44.  
  45.  
  46. local debounce = true
  47. local b = workspace:WaitForChild("BREAKABLES")
  48. wait(1)
  49. debounce = false
  50. local stuff = b:GetChildren()
  51. for i = 1, #stuff do
  52. local hitboxes = stuff[i]:GetChildren()
  53. for i = 1, #hitboxes do
  54. if hitboxes[i].Name == "HitBox" then
  55. if hitboxes[i]:FindFirstChild("ClickDetector") ~= nil and hitboxes[i].Parent:FindFirstChild("Broken") ~= nil then
  56. if hitboxes[i].Parent.Broken.Value == false then
  57. hitboxes[i].ClickDetector.MouseClick:Connect(function()
  58. if debounce == false then
  59. debounce = true
  60. hitboxes[i].Parent.Broken.Value = true
  61. local bricks = hitboxes[i].Parent:GetChildren()
  62. local character = game.Players.LocalPlayer.Character
  63. character.Humanoid.WalkSpeed = 0
  64. character.Humanoid.JumpPower = 0
  65. local hrp = character.HumanoidRootPart
  66. local newpos = Vector3.new(hitboxes[i].Position.X, hrp.Position.Y, hitboxes[i].Position.Z)
  67. hrp.CFrame = CFrame.new(hrp.Position, newpos)
  68. SpawnWeapon()
  69.  
  70.  
  71. for i = 1, #bricks do
  72. if bricks[i]:IsA("Part") or bricks[i]:IsA("MeshPart") or bricks[i]:IsA("UnionOperation") then
  73. bricks[i].Transparency = bricks[i].Transparency + 1
  74. end
  75. end
  76. if hitboxes[i].Parent:FindFirstChild("ParticleBrick") ~= nil then
  77. if hitboxes[i].Parent.ParticleBrick:FindFirstChild("ParticleEmitter") ~= nil then
  78. hitboxes[i].Parent.ParticleBrick.ParticleEmitter.Enabled = true
  79. wait(0.2)
  80. hitboxes[i].Parent.ParticleBrick.ParticleEmitter.Enabled = false
  81. end
  82. if hitboxes[i].Parent.ParticleBrick:FindFirstChild("BreakSound") ~= nil then
  83. hitboxes[i].Parent.ParticleBrick.BreakSound:Play()
  84. end
  85. end
  86. if character:FindFirstChild("BreakingSword") ~= nil then
  87. character.BreakingSword:Destroy()
  88. end
  89. character.Humanoid.WalkSpeed = 20
  90. character.Humanoid.JumpPower = 50
  91. debounce = false
  92.  
  93. if hitboxes[i].Parent:FindFirstChild("RespawnTime") ~= nil then
  94. wait(hitboxes[i].Parent.RespawnTime.Value)
  95. for i = 1, #bricks do
  96. if bricks[i]:IsA("Part") or bricks[i]:IsA("MeshPart") or bricks[i]:IsA("UnionOperation") then
  97. bricks[i].Transparency = bricks[i].Transparency - 1
  98. end
  99. end
  100. hitboxes[i].Parent.Broken.Value = false
  101. end
  102. end
  103. end)
  104. end
  105. end
  106. end
  107. end
  108. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement