How to give a model a sparkle effect when it is clicked?

script.Parent.MouseClick:Connect(function()
	local ss = game.ServerStorage
	local capsule = ss.Capsule:GetChildren()
	wait(1)
	script.Parent.Parent:Destroy()
	print("DESTROY!!!!!!!!")
end)

how do i change this to add a sparkle effect to the model?

1 Like

i guess put a disabled particle emitter inside it and use :Emit() https://create.roblox.com/docs/reference/engine/classes/ParticleEmitter#Emit

1 Like

Add a particleemitter into script.Parent.Parent.

Then add:

script.Parent.Parent.ParticleEmitter:Emit(20)

That’ll emit 20 particles everytime it’s called (executed)

1 Like

Hello!

Your code should look something like this:

script.Parent.MouseClick:Connect(function()
	local ParticleEmitter = script.Parent.Parent.Part.ParticleEmitter -- Make sure to parent the ParticleEmitter to a part inside the model or the model's PrimaryPart.  If this is not done, it will not work!
	ParticleEmitter.Enabled = true -- The Enabled property of the ParticleEmitter must to false after it is created.
	ParticleEmitter:Emit(50) -- Emits 50 particles when clicked.  Change 50 to however many particles you want it to emit.
	
	local ServerStorage = game:GetService("ServerStorage")
	local Capsule = ServerStorage.Capsule:GetChildren()
	task.wait(1)
	script.Parent.Parent:Destroy()
	print("DESTROYED!!!!")
end)

Hope this helps! :slight_smile:

Thanks for all the replies i’ll try them out and see what works :slight_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.