How to make particles visible to the entire server?

I have a set of particles that are enabled in the use of keybinds.
These use LocalScripts located in StarterGui.

However, it is only visible to me, and no one else.
I am unaware of how to make the particles visible to an entire server.

Here is the script:

local userInputService = game:GetService("UserInputService")
local particle = game.Workspace.Fountains.FountainB.cannon.particleCore.fountain

userInputService.InputBegan:Connect(function(input, gp)
	if gp then return end

	if input.KeyCode == Enum.KeyCode.B then
		particle.Enabled = true
	end
end)

userInputService.InputEnded:Connect(function(input, gp)
	if gp then return end

	if input.KeyCode == Enum.KeyCode.B then
		particle.Enabled = false
	end
end)

This is a particle that enables when the B key is held.
Yet, it only shows for me, and no one else.
Is there any way to make it visible for everyone?

I think this is a duplicated question in forum from yours:

is there a reason why the LocalScript is in StarterGui when i dont find any lines about it?
just put the particle in ReplicatedStorage and do this
also put this script in starterplayer and startercharacterscripts

local userInputService = game:GetService(“UserInputService”)
local particle = game.ReplicatedStorage.YOURPARTICLENAMEHERE:Clone()

userInputService.InputBegan:Connect(function(input, gp)
if gp then return end

if input.KeyCode == Enum.KeyCode.B then
	particle.Parent = script.Parent.Parent.Parent
end

end)

userInputService.InputEnded:Connect(function(input, gp)
if gp then return end

if input.KeyCode == Enum.KeyCode.B then
		particle:Remove()
end

end)

hope this helps :slight_smile:

Doesn’t seem to work.

It only shows that it’s cloning the particle to the StarterPlayer, yet the particle isn’t visible at all.

i upgraded the code a bit, hope this maybe helps

local userInputService = game:GetService(“UserInputService”)
local particle = game.ReplicatedStorage.YOURPARTICLENAMEHERE:Clone()

userInputService.InputBegan:Connect(function(input, gp)
if gp then return end

if input.KeyCode == Enum.KeyCode.B then
	particle.Parent = script.Parent.Parent.Parent.Head
particle.Enabled = true
end
end)

userInputService.InputEnded:Connect(function(input, gp)
if gp then return end

if input.KeyCode == Enum.KeyCode.B then
		particle:Remove()
end
end)
1 Like

You can use a remote event when the user input service runs… isn’t it?

I think your code works if he wants to put the particle on the user’s avatar / head,but in this case he wants to put it for a model in workspace so remote event could fix the issue :smiley:

I tried to work with remote events previously, even with help from a dev.
But I got burnout from struggling to connect it all together.

I think in my case whatever I have is too unorganized, and I don’t know how to compile it all together.

oh i thought that he wants it to player since he was using a Localscript and it was in Startergui
thanks for letting me know

1 Like

hm… I see so you basically have to store a remote event in replicated storage and
In the local script
after

if input.KeyCode == Enum.KeyCode.B then
game.ReplicatedStorage.RemoveEvent:FireServer(input)
	end

and in ServerScript

local particle = game.Workspace.Fountains.FountainB.cannon.particleCore.fountain
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player,input)
particle.Enabled = true 
end)

So basically, you’d have to make a remote event and then a server script. Inside the server script link the remote event.

I have figured this out already, so that first issue is done with.

But I did encounter another problem.
Now that I tied every LocalScript to a ServerScript, and the remote events, when I press a key, it enables every particle, instead of the corresponding particle.

Is there any way to specify which particle should fire with the remove events?

Yes. Make a variable in the local script when you fire it (i.e. FireServer(true))

Add a true or false, or literally anything, doesn’t matter. Then on your server side declare that variable :OnServerEvent(Player, Check)

After than make a quick if statement, like if Check == true then particle.Enabled = true end

That should do it :slight_smile:

How may I implement this into my current scripts? (first is local, second is server)


Just don’t have much time at home since I’m going somewhere, that’s why I’m asking.

I disabled everything else except two of the particles that should enable separately.
But, they still play at the same time no matter which key I press.

Is this the correct setup? (first local, second server)