How to make particle enabled and visible to everyone if player has a certain tool in their BACKPACK?

you know what im just going to start roblox studio and actually try the code

1 Like

I’m seeing this in Output:

oh lemme check the code real quick

1 Like

It’s supposed to be if v.Name == "Light1" or v.Name == "Light2" or else it will destroy everything in the root part.

Also, it’s probably causing the error because data.Parent is nil.

doesnt work:

I finally know why its not working i know why!!!

1 Like

can you send me the whole code of the server script real quick

1 Like

what is it?!?!?!?!??!?!?!?!?!?!?!!?

it is because in the server script we didnt fireallclients back the parent causing it to be nil

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage.LightEvent

RemoteEvent.OnServerEvent:Connect(function(player,actionType)
local character = player.Character
local HitCube = character:WaitForChild("HitCube")

if actionType == "Light" then
	RemoteEvent:FireAllClients(
		{
			ActionType = "Light",
			Parent = HitCube
		}
	)
elseif actionType == "LightCanceled" then
	RemoteEvent:FireAllClients(
		{
			ActionType = "LightCanceled"
		}
	)
	
end
end)

Of course, it won’t fix the error, it’s going to fix a problem you will have after you fix the error. The error is because data.Parent doesn’t exist, probably because it’s whatever you’re sending to the data.

edit: I think I know:
Simply add “Parent” as a key to the “LightCanceled”, like this:

elseif actionType == "LightCanceled" then
	RemoteEvent:FireAllClients(
		{
			ActionType = "LightCanceled";
Parent = HitCube
		}
	)
	
end

local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local RemoteEvent = ReplicatedStorage.LightEvent

RemoteEvent.OnServerEvent:Connect(function(player,actionType)
local character = player.Character
local humanoidRootPart = character.HumanoidRootPart
local HitCube = character:WaitForChild(“HitCube”)

if actionType == “Light” then
RemoteEvent:FireAllClients(
{
ActionType = “Light”,
Parent = HitCube
}
)
elseif actionType == “LightCanceled” then
RemoteEvent:FireAllClients(
{
ActionType = “LightCanceled”,
Parent = HitCube
}
)

end
end)

and if the hitcube is set to the particleEmitter’s parent , then you would have to change the both of the parents to hitcube

i literally forgot to add back the data.Parent for lightcanceled lol my mistake :joy:

its giving me these:

1 Like

i think a better solution for the vfx is to put it in replicatedstorage so its cleaner and way easier to access instead of putting it in the hitcube

if they get put in replicatedstorage then how will they appear on the player?

1 Like

its the same thing by cloning it like Lets say u put the light1 and light2 particles in replicatedStorage then

when u clone it, it would be like
local Light1 = ReplicatedStorage.Light1:Clone()

2 Likes

When I try this it clones Light1 a lot when I equip/unequip but names like half of the clones “Light2” even though it’s just the same particle emitter.

1 Like

maybe because you didnt set light2 to replicatedstorage.light2:Clone()
honesty you dont have to do this because this is up to your personal preference

2 Likes