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

I’m trying to make a script that enabled particles/Lights on my custom startercharacter when the player has a certain tool in their BackPack. If they dont have the tool in their backpack then the particles/lights will be disabled. I also can’t seem to find a way to make EVERYONE see the particles/lights on you. I’ve tried local and server scripts. but all I can pretty much provide is the local script located in startercharacterscripts:

local HitCube = script.Parent:FindFirstChild("HitCube") --HitCube is a part inside the custom startercharacter that contains all the effects/lights.
LightLight = HitCube:FindFirstChild("LightLight") --pointlight
Light1 = HitCube:FindFirstChild("Light1") --particle 1
Light2 = HitCube:FindFirstChild("Light2") --particle 2
local Player = game:GetService("Players").LocalPlayer

function checkForTool()
if Player.Backpack:WaitForChild("Light") then --Name of the tool
LightLight.Enabled = true
Light1.Enabled = true
Light2.Enabled = true
else
LightLight.Enabled = false
Light1.Enabled = false
Light2.Enabled = false
end
end

Player.Backpack.ChildAdded:Connect(checkForTool)
Player.Backpack.ChildRemoved:Connect(checkForTool)

And here’s a picture of the HitCube containing all the effects/lights located in the custom startercharacter:
Screenshot (91)
HELP IS GREATLY APPRECIATED :slight_smile:

3 Likes

remoteEvent’s fireallclients might work

1 Like

tysm for helping! but I’m not a good scripter at all so I’m not sure how that would look in this script. (idk where to type that at in my current script). Also is having the script that I’m using a localscript good or bad? like is it the reason why it’s not showing for everyone? Because right now, the script I’m using is making the effects show but only for me. I need it to show for everyone.

do you want me to provide you with an example

1 Like

yes please! that would appreciated very much!

let me know if it works or no
RemoteFunction works too but there will be a slight delay

before I test it, does that first script go into a localscript inside StarterCharacterScripts? and does that second Sever Script go into StarterCharacterScripts as well?

the first scripts goes in the startercharacterscripts because you wouldnt really want to put it in starterplayerscripts because if you do that, the script will only fire once when the player joins

second, you should put it in serverscriptservice because you wouldnt be able to use a server script in a startercharacterscript

1 Like

sorry for asking a ton but what does that duration mean?

i fixed the code quite a bit so now if the player have the item it will have the effect permanently
and if the player have the effect and the item is gone then it would be removed

How do I fix these errors?

the (light 1 or light 2 )
i meant you could chose from Light1 or Light2

wait im just going to open roblox studio and type it straightly so you could use the whole code without error

1 Like

oh yea I saw that but for the RemoteEvent, and the two checkForTool().and the end)

– Server script
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local RemoteEvent = ReplicatedStorage.RemoteEvent

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

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

end)
now it should work

it works! but one thing… instead of making the particles disappear after 10 sec. I want it to be enabled as long as the player has the tool in their BackPack. And will be disabled when the player doesnt have that tool in their backpack.

i changed the whole code above the effect should be enabled while the player has the tool

uhm… there’s a bug. I tested it with another player and when I equipped the Light tool, I could see the effects on myself, but on the other player’s screen… they also see the effects but on their self and not on me. And the other player didn’t even have the tool.

wait I forgot! I forgot to parent the effect to the player’s humanoidRootPart

i edited the code above it should work now

1 Like