CarbonH.Touched:connect(function(part) local debounce = false local h = part.Parent:FindFirstChild("Humanoid") if not h and (not debounce) and (part.Parent ~= Player.Character) and (part.Parent.Parent ~= Player.Character) then debounce = true local function debri() local Debri = Instance.new("Part") Debri.BrickColor = part.BrickColor Debri.Material = part.Material Debri.Anchored = true Debri.CanCollide = true Debri.Size = Vector3.new(math.random(5, 20), 4, math.random(5, 20)) Debri.CFrame = CFrame.new(CarbonH.Position) * CFrame.Angles((math.random()-0.5)*math.pi*2.4, (math.random()-0.5)*math.pi*2.4, (math.random()-0.5)*math.pi*2.4) Debri.Parent = workspace Debri.TopSurface = 10 Debri.BottomSurface = 10 local Debri2 = Instance.new("Part") Debri2.BrickColor = BrickColor.new("Black") Debri2.Material = 800 Debri2.Anchored = false Debri2.CanCollide = true Debri2.Size = Vector3.new(5, 5, 5) Debri2.CFrame = CFrame.new(CarbonH.Position) Debri2.Parent = workspace Debri2.TopSurface = 10 Debri2.BottomSurface = 10 for i = 1, 4 do local Debris = Debri:Clone() Debris.Parent = workspace Debris.Size = Vector3.new(math.random(5, 20), 4, math.random(5, 20)) Debris.CFrame = CFrame.new(CarbonH.Position) * CFrame.Angles((math.random()-0.5) * math.pi * 2.4, (math.random()-0.5) * math.pi * 2.4, (math.random()-0.5) * math.pi * 2.4) end end local ExplosionRingPart= Instance.new("Part") local ExplosionRingMesh = Instance.new("SpecialMesh", ExplosionRingPart) ExplosionRingPart.Anchored = true ExplosionRingPart.CanCollide = false ExplosionRingPart.Transparency = 0.5 ExplosionRingPart.CFrame = CFrame.new(CarbonH.Position - Vector3.new(0, 2, 0)) * CFrame.Angles(1/2 * math.pi, 0, 0) ExplosionRingMesh.Scale = Vector3.new(5, 5, 0.3) ExplosionRingMesh.MeshId = "http://www.roblox.com/asset/?id=3270017" ExplosionRingPart.Parent = workspace while ExplosionRingMesh.Scale.X ~= 10 and ExplosionRingPart.Transparency ~= 1 do -- the loop that keeps crashing ExplosionRingMesh.Scale = ExplosionRingMesh.Scale + Vector3.new(1, 1, 0) ExplosionRingPart.Transparency = ExplosionRingPart.Transparency + 0.1 wait(0.1) end debri() CarbonH:Destroy() end end)
I dont see any problems and the there are no errors in the output. I have no idea why it keeps crashing, please help. Sorry if the code is hard to read, I tried my best to make it as simple as possible.