Making effects show on every client

I have realized that making effects and such on the client rather than the server is far better
and i honestly have no idea how i would go about doing such a thing

I’ve tried for a good bit and as you can imagine while i am able to get the effect to spawn on the casters client it doesn’t replicate onto others

Heres my code
image
this fires to the server ^
image
this fires back onto the client in order to make the effects


and this is the effect code

1 Like

do on the server

Remmy:FireAllClients()
1 Like

nono that wont work cause then itll make every client spawn their own little box and other clients wont be able to see it but everyone spawns a box

Oh you mean like a player does a move and it does the vfx on the client? If so, why not just do the vfx after you fire to the server while being on the client?

yeah your right i just tried it and it still works (which is really good for optimization ty) but i don’t think it will fix my problem

What issue :skull:

Replicating the effects on the person conducting the ability was the issue but now it’s good. What other problems do you have? Are you sure you explained your issue clearly?

alright think of like a fireball attack. When you use one you (the caster) has to see the fireball spawn from your body and the other clients need to see that fireball approching them. The problem is when you use local scripts the effects only show on the casters point of view unless you do somthing to make every client able to see said fireball (cause if you dont they will just get hit by attacks they cant see). When i press the keybind i have associated to spawn the box it shows on the casters screen but not any other clients screen

The problem is you don’t have a system to work with. You first need to create a visual FX system that works on the server (so every client can see it without events) and then have another system that only works on the clients via events (like sparks or visual effects that don’t actually affect the client itself).

With those two systems, you can pick which one is appropriate for the situation. You mentioned a fireball for the first one that all clients need to see and clients need to be about to interact with, that would be a server side visual FX then.

First of all no. There’s no such thing as “server side” FX.

Time to show you a way you can do this. The code I show is not for use but to show how a system like this could work.

–My hierarchy–
->ClientScript
---->ServerScript
---->AbilityEvent
---->EffectReplicator (Event)

–Client–

local UIS = game:GetService("UserInputService")

local Event = script.AbiltyEvent
local EffectReplicator = script.EffectReplicator

local FireBall:BasePart = nil 


local function FireServer(A:InputObject, B:boolean)
	if B then return end

	if A.KeyCode == Enum.KeyCode["Z"] then
		Event:FireServer("FireBall")
	end
end

local function Replicator(Ability:string, SpawnCF:CFrame)
	if Ability == "Fireball" then
		local ClonedEffect = FireBall:Clone()
		ClonedEffect.CFrame = SpawnCF
		ClonedEffect.Parent = workspace
		
		--Other logic
	end
end

UIS.InputBegan:Connect(FireServer)
EffectReplicator.OnClientEvent:Connect(Replicator)

–Server–

local AbilityEvent = script.Parent.AbiltyEvent
local EffectReplicator = script.Parent.EffectReplicator

AbilityEvent.OnServerEvent:Connect(function(player: Player, Ability:string) 
	if Ability == "Fireball" then
		local SpawnCframe:CFrame = player.Character.HumanoidRootPart.CFrame
		
		EffectReplicator:FireAllClients(Ability, SpawnCframe)
	end
end)
1 Like

you should be doing a
Client → Server → All Clients
function / event chain

during Client → Server portion, server performs validation checks
if valid will fire a separate Server-> All Clients event for the associated ability to be animated on all clients that has been connected in their local scripts

In the final Server → original Client, return any needed values from the server

The reply above mine has a good code example

Of course there is :face_exhaling:, not every special FX is appropriate for the Client. Especially when some type of physics and interaction is attached to it. Otherwise, you create an unnecessary and inefficient chain of events between the clients and server. It doesn’t mean one should use server based special FX for everything because it waste bandwidth and server resources, but to say there is no such thing is demonstrating lack of knowledge and experience in game coding. :face_with_raised_eyebrow:

1 Like

You implied server-only FX which I said was wrong, any FX can be replicated on the client. Indeed, you don’t need to replicate all the effects on the client but if your game is huge it’s better to do most of the FX on the client

Like what? A fireball for example would be anchored meaning there’s no physics applied to it + what interactions? It’s an effect that is supposed to come and go, why would you attach anything special to it?

I’m not even going to say anything but it seems you’re the inexperienced one because different games have different structures.

If you do the :FireAllClients(), parsing the casting player and spawn the box in the casting player’s position then everyone sees the box in the caster’s position.

I have your quote in the previous message, can’t back out of that one. :wink: My message is there for all to read, it was in response to your “There’s no such thing as “server side” FX.” That statement is demonstrably false. :face_with_raised_eyebrow:

I will be glad to retract what I said and offer an apology because this does not help the OP with their issue. I won’t go back and edit what I said to cover it up. It was not becoming of me to make you feel insulted, that was my mistake. I took your response as a falsehood attack, next time I will be more civil with my response. :+1:

1 Like

I was never insulted :skull:
Could you reply to the questions asked in my reply (section 2)?

And can you also answer how I am “demonstrably false”?

I know this doesn’t help the OP but questions can’t go unanswered.

Edit: Yk what this is a useless ramble anyway and a waste of time