you know what im just going to start roblox studio and actually try the code
How to make particle enabled and visible to everyone if player has a certain tool in their BACKPACK?
oh lemme check the code real quick
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
.
I finally know why its not working i know why!!!
can you send me the whole code of the server script real quick
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
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?
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()
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.
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