So what I have here is an opensource script that is very unique. Nothing quite like it. What it is is just a death but your character explodes in tiny little particle squares. This is very fitting in my game.

Here's the script

local FORCE = 25 -- max sideways velocity
local UP_VELOCITY = 70 -- max upwards velocity
local AMT = 10 -- per stud^3
local AFFECTED_BY_PHYSICS = true -- whether or not to let the particles interact with the world - if false, they will be removed on contact
local DURATION = 15 -- how long the particles stay visible for

local particleGUIs = {}
local particleModel = Instance.new("Model", workspace)
particleModel.Name = "ParticleContainer"

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")
		humanoid.Died:connect(function()
			print("Done")
			character.HumanoidRootPart:Destroy()
			for _, limb in pairs(character:GetChildren()) do
				if limb:IsA("BasePart") then
					for i = 1, limb:GetMass() * AMT do
						local p = Instance.new("Part", particleModel)
						p.Name = "Particle"
						p.CanCollide = false
						p.FormFactor = Enum.FormFactor.Custom
						p.Size = Vector3.new()
						p.CFrame = limb.CFrame
						p.Velocity = Vector3.new(math.random()*2-1, 0, math.random()*2-1).unit * FORCE + Vector3.new(0, math.random()*UP_VELOCITY, 0)
						p.CanCollide = AFFECTED_BY_PHYSICS
						if not AFFECTED_BY_PHYSICS then p.Touched:connect(function(hit) if hit.Name ~= "Particle" then p:Destroy() end end) end
						p.Transparency = 1
						local gui = Instance.new("BillboardGui", p)
						gui.Adornee = p
						gui.Size = UDim2.new(0.5, 0, 0.5, 0)
						local square = Instance.new("ImageLabel", gui)
						square.BorderSizePixel = 0
						square.Size = UDim2.new(1, 0, 1, 0)
						square.BackgroundColor3 = limb.BrickColor.Color
						table.insert(particleGUIs, square)
					end
					limb:Destroy()
				end
			end
		end)
	end)
end)

while true do
	local elapsed = wait(15)
	for index, particle in pairs(particleGUIs) do
		particle.BackgroundTransparency = particle.BackgroundTransparency + elapsed/DURATION
		if particle.BackgroundTransparency > 1 then
			particleGUIs[index] = nil
			particle.Parent.Parent:Destroy()
		end
	end
end

Thank you! You guys are the best.``

4 comments

0

Try doing 'while wait(15) do' or 'while true do wait(15)' instead of the one you have for line 47. Also, line 22 is not needed because of line 27.

0

That didn't work, or maybe i did it wrong. What exactly are you saying with line 47?

0

He's saying this: Instead of writing "local elapsed = wait(15)", you should write " while wait(15) do"

0

the problem with that is that elapsed is actually a value of sorts you know what i mean. I'm a beginner so I barely know what I'm talking about but I'm sure that "elapsed" is something of importance