Roblox Studio contradicting itself?

I have this script where it creates a particle, but it prints this error "hitpart is not a valid member of ParticleEmitter “Workspace.Part.hitpart” "

When I print the class name tho, it says its a ParticleEmitter. (contradicting itself???)

Here is the code

coroutine.wrap(function()
	local HitParticle = Instance.new("Part")
	HitParticle.Parent = game.Workspace

	local Particle = script.hitpart:Clone()
	print(Particle.ClassName) -- Prints Particle Emitter
	Particle.Parent = HitParticle
	HitParticle.Position = result.Position
	HitParticle.CFrame = CFrame.new(result.Position, result.Position + result.Normal)
					
	Particle.hitpart:Emit(40)
					
	wait(0.25)
	HitParticle:Destroy()
end)()


image

I don’t know why this is happening, is it a studio bug?

Particle IS hitpart, I think. Particle:Emit(40)

Wouldn’t it just be Particle:Emit(40) as the particle variable is the emitter

1 Like

hitpart property is being accessed incorrectly on the ParticleEmitter.
Instead of trying to access a non-existent property hitpart , directly call the Emit method on the ParticleEmitter instance (Particle ), as shown below:

Particle:Emit(40) -- corrected syntax

This should resolve the error

1 Like

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