An error with emitting the particle

I really need help with emitting the particle based on how much the player has clicks. I have been struggling with this for over 4 hours and still cant find a solution even to such an easy - one might say - task. Please help.

This is what shows up after activating the tool:

image
image

How it is stored:

image

Here is the code:

toolEvent.OnServerEvent:Connect(function(player)
	local part
	local att
	local partEmmit
	local char = player.Character or player.CharacterAdded:Wait()
	local hrp = char:WaitForChild("HumanoidRootPart")

	local clicks = player.leaderstats:WaitForChild("Strenght")

	local function ToolName()
		if char:FindFirstChild("Fire1") then
			part = char.Fire1.Part:Clone()
		elseif char:FindFirstChild("Fire2") then
			part = char.Fire2.Part:Clone()
		else
			return
		end

		part.Parent = workspace.Stuff
		part.Anchored = true -- Important so it stays in place
		part.CanCollide = false -- No collision needed
		part.Transparency = .5 -- Fully invisible Part

		att = part:WaitForChild("Attachment")
		partEmmit = att:WaitForChild("ParticleEmitter")
	end

	ToolName() -- <<< CALL THE FUNCTION here!!

	local function emitterAmount()
		local emmitAmount

		if char:FindFirstChild("Fire1") and clicks.Value <= 50 then
			emmitAmount = math.floor(clicks.Value / 2)
		elseif char:FindFirstChild("Fire1") and clicks.Value > 50 then
			emmitAmount = 25
		end

		if char:FindFirstChild("Fire2") and clicks.Value <= 100 then
			emmitAmount = math.floor(clicks.Value / 4)
		elseif char:FindFirstChild("Fire2") and clicks.Value > 100 then
			emmitAmount = 25
		end

		if emmitAmount < 1 then
			emmitAmount = 1
		end

		return emmitAmount
	end

	-- Create a new Attachment

	local offset = hrp.CFrame.LookVector * 5
	part.CFrame = hrp.CFrame + offset

	local emitter = att:FindFirstChild("ParticleEmitter")
	if emitter then
		print("Emitter found: " .. emitter.Name)
		emitter:Emit(emitterAmount()) -- Use the calculated emitter amount
		print(emitterAmount(), "particles emitted!")
		print("Clicks:", clicks.Value)

		task.delay(0.5, function()
			part:Destroy()
		end)
	else
		warn("No ParticleEmitter found.")
	end
end) 

bump - please if anybody can help i would be very thankful

What is the issue exactly? It seems that you are already emitting particles based on player’s strength.

I dont know why but it seems like the particle just doesnt emitt. I dont know why is it and i tried many things. Everything works besides the emittion

What do you want to achieve when you perform the activity?

I want the particle to emmit particles when the remoteEvent is fired

Review this code and try this one, see if it improves:

toolEvent.OnServerEvent:Connect(function(player)
local part, att, partEmmit
local char = player.Character or player.CharacterAdded:Wait()
local hrp = char:WaitForChild(“HumanoidRootPart”)
local clicks = player.leaderstats:WaitForChild(“Strenght”)

local function ToolName()
    local fire1 = char:FindFirstChild("Fire1")
    local fire2 = char:FindFirstChild("Fire2")

    if fire1 then
        part = fire1.Part:Clone()
    elseif fire2 then
        part = fire2.Part:Clone()
    else
        return
    end

    part.Parent = workspace.Stuff
    part.Anchored = true
    part.CanCollide = false
    part.Transparency = 0.5

    att = part:WaitForChild("Attachment")
    partEmmit = att:WaitForChild("ParticleEmitter")
end

ToolName()
if not part or not att then
    warn("No valid part or attachment found.")
    return
end

local function emitterAmount()
    local emitAmount
    local fire1 = char:FindFirstChild("Fire1")
    local fire2 = char:FindFirstChild("Fire2")

    if fire1 and clicks.Value <= 50 then
        emitAmount = math.floor(clicks.Value / 2)
    elseif fire1 and clicks.Value > 50 then
        emitAmount = 25
    elseif fire2 and clicks.Value <= 100 then
        emitAmount = math.floor(clicks.Value / 4)
    elseif fire2 and clicks.Value > 100 then
        emitAmount = 25
    else
        emitAmount = 1
    end

    return math.max(emitAmount, 1)
end

local offset = hrp.CFrame.LookVector * 5
part.CFrame = hrp.CFrame + offset

local emitter = att:FindFirstChild("ParticleEmitter")
if emitter then
    local amountToEmit = emitterAmount()
    emitter:Emit(amountToEmit)
    print(amountToEmit, "particles emitted!")
    print("Clicks:", clicks.Value)

    task.delay(0.5, function()
        part:Destroy()
    end)
else
    warn("No ParticleEmitter found.")
end

end)

No it still doesnt work. What do you think could be the issue here?

Based on the picture, it seems the particle emitter is emitting, but too dark

it might look like that but it really isnt. I am going to try doing it on a new baseplate

try different texture or manipulate the properties especially on transparency, size, speed, and time

May I see the property of the particle emitter?

Here is how the particle looks like:
image

I think you should use :Emit(“put any number here”) stead.

to do that follow this code:

local ParticleEmit = script.Parent
ParticleEmit:Emit(1)

i already tried that and it doesnt work

OMG I FIGURED IT OUT. My attachment was moved. What i mean by that is the position of att wasnt the same as the part. I am sorry for taking your time, but i think that without you i wouldnt be able to do it.

1 Like

Ohh, I was remaking it to my studio, glad you figured it out

If you want you can still send it so i can improve my things. And btw wow I am impressed that you wanted to go so far. Thanks again man!

1 Like