Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function SpawnWeapon()
- local player = game.Players.LocalPlayer
- local wep = game.ReplicatedStorage:FindFirstChild("Fallen King")
- local weapon = wep:Clone()
- weapon.Parent = player.Character
- weapon.Name = "BreakingSword"
- local parts = player.Character:GetChildren()
- local wparts = weapon:GetChildren()
- for g = 1, #wparts do
- if wparts[g]:IsA("Part") or wparts[g]:IsA("UnionOperation") or wparts[g]:IsA("MeshPart") then
- wparts[g].Transparency = wparts[g].Transparency + 1
- end
- end
- for i = 1, #parts do
- if parts[i]:IsA("MeshPart") then
- for q = 1, #wparts do
- if wparts[q].Name == parts[i].Name then
- wparts[q].CFrame = parts[i].CFrame
- local Y = Instance.new("Weld")
- Y.Part0 = parts[i]
- Y.Part1 = wparts[q]
- Y.C0 = CFrame.new(0, 0, 0)
- Y.Parent = Y.Part0
- end
- end
- end
- end
- local animTrack = player.Character.Humanoid:LoadAnimation(weapon.Animation)
- animTrack:Play()
- weapon.PARTICLES.Particle.Enabled = true
- weapon.Damager.Glow:Play()
- wait(0.2)
- weapon.PARTICLES.Particle.Enabled = false
- wait(0.25)
- for g = 1, #wparts do
- if wparts[g]:IsA("Part") or wparts[g]:IsA("UnionOperation") or wparts[g]:IsA("MeshPart") then
- wparts[g].Transparency = wparts[g].Transparency - 1
- end
- end
- wait(0.35)
- weapon.Damager.Sound1:Play()
- wait(0.15)
- end
- local debounce = true
- local b = workspace:WaitForChild("BREAKABLES")
- wait(1)
- debounce = false
- local stuff = b:GetChildren()
- for i = 1, #stuff do
- local hitboxes = stuff[i]:GetChildren()
- for i = 1, #hitboxes do
- if hitboxes[i].Name == "HitBox" then
- if hitboxes[i]:FindFirstChild("ClickDetector") ~= nil and hitboxes[i].Parent:FindFirstChild("Broken") ~= nil then
- if hitboxes[i].Parent.Broken.Value == false then
- hitboxes[i].ClickDetector.MouseClick:Connect(function()
- if debounce == false then
- debounce = true
- hitboxes[i].Parent.Broken.Value = true
- local bricks = hitboxes[i].Parent:GetChildren()
- local character = game.Players.LocalPlayer.Character
- character.Humanoid.WalkSpeed = 0
- character.Humanoid.JumpPower = 0
- local hrp = character.HumanoidRootPart
- local newpos = Vector3.new(hitboxes[i].Position.X, hrp.Position.Y, hitboxes[i].Position.Z)
- hrp.CFrame = CFrame.new(hrp.Position, newpos)
- SpawnWeapon()
- for i = 1, #bricks do
- if bricks[i]:IsA("Part") or bricks[i]:IsA("MeshPart") or bricks[i]:IsA("UnionOperation") then
- bricks[i].Transparency = bricks[i].Transparency + 1
- end
- end
- if hitboxes[i].Parent:FindFirstChild("ParticleBrick") ~= nil then
- if hitboxes[i].Parent.ParticleBrick:FindFirstChild("ParticleEmitter") ~= nil then
- hitboxes[i].Parent.ParticleBrick.ParticleEmitter.Enabled = true
- wait(0.2)
- hitboxes[i].Parent.ParticleBrick.ParticleEmitter.Enabled = false
- end
- if hitboxes[i].Parent.ParticleBrick:FindFirstChild("BreakSound") ~= nil then
- hitboxes[i].Parent.ParticleBrick.BreakSound:Play()
- end
- end
- if character:FindFirstChild("BreakingSword") ~= nil then
- character.BreakingSword:Destroy()
- end
- character.Humanoid.WalkSpeed = 20
- character.Humanoid.JumpPower = 50
- debounce = false
- if hitboxes[i].Parent:FindFirstChild("RespawnTime") ~= nil then
- wait(hitboxes[i].Parent.RespawnTime.Value)
- for i = 1, #bricks do
- if bricks[i]:IsA("Part") or bricks[i]:IsA("MeshPart") or bricks[i]:IsA("UnionOperation") then
- bricks[i].Transparency = bricks[i].Transparency - 1
- end
- end
- hitboxes[i].Parent.Broken.Value = false
- end
- end
- end)
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement