Particles showig only for my client

Im using a system i think would save quite a lot of server memory for combat. Lets say only you can fight, so only you have a local script (A) that has the triggers for abilities and cooldowns and all. I know the process can seem pretty long but this local script (A) sends info to a script inside it, that also redirects the info to another local script (B) that, this time, all players have. this local script (B) deals w the visual effects, sounds and hit-detection. On hit it, it does a few checks and fires a remote event to deal damage on the server side.

Enough of that, i’ve used this method quite a lot of times and it works very smoothly but seems to stutter when i’m not fighting dummies :skull: (when fighting other players)

Well let’s just stick to the particle issue for now and i’ll try to figure out the rest on my own. Im using particle:Emit(n) to emit a bunch of particles at once when the “OnHit” function is triggered.
This seems to work fine for the person who’s performing the abilities, but it doesnt show for others.

The system intends to show these particles and vfx and play sounds for every client, just not on the server (things like knockback and damage aside), and all the scripts are located in StarterCharacterScripts

heres the local script (A) (only the important parts)

uis.InputBegan:Connect(function(input, gameProcessed)
	local attackAnim = plrHum:LoadAnimation(script.Attack1)
	attackAnim:Play()
	script.Call:FireServer(player, anim) -- fires to a remote event that sends the info to local script (B)
end)

same for local script (B)

game.ReplicatedStorage.CombatEvent.OnClientEvent:Connect(function(callingPlayer, anim)
	AbilityHitbox.Touched:Connect(function(hit)
		if hum and not humanoidsThatHaveBeenHit[hum] and hum.Health > 0 then
			script.DamageEvent:FireServer(hum, callingPlayer, anim) -- also contains knockbacks 
			particle:Emit() -- this is only showing for the "calling player" who is the one casting the ability
		end
	end)
end)

It says that both scripts are local scripts?
Is

same for local script (B)

suppose to be a server script?

the “Local script (B)” is in everyone’s StarterCharacterScripts, its main job is to show vfx. “Local script (A)” is what triggers the abilities

So is it a local script or a server script?
Cause it says local script

its a local script, the server scripts are 2, one that sends info from local script (A) to (B), and the other applies damage

Ok I think the problem is coming from the server script. Cause It should fire effects on all clients if you send it from the server.

Can I see the server script?

script.Parent.Call.OnServerEvent:Connect(function(player, callingPlayer, anim)
	game.ReplicatedStorage.CombatEvent:FireAllClients(callingPlayer, anim)
end)

its really simple, nothing really looks wrong. The effects are fired from a local script not from the server

My guess is that when you do

AbilityHitbox.Touched:Connect(function(hit)

This is probably only running on the client and not running for everyone.
To figure this out try and find where it stops working.

Try putting a print after

AbilityHitbox.Touched:Connect(function(hit)
and see if it runs for all clients.
Keep doing this in different places till you find where it is not running

imma try sending the local player’s name to the damage server script and print it from there cause it would only show that client’s name

1 Like

This did actually solve an issue, knockbacks werent applying in the server script, which was because of an object that i assumed existed, but it wasnt actually there. i’ve done lots of tweaks that i actually dont remember what i did but i ended up adding a condition to the damage event firing that goes

if callingPlayer == game.Players.LocalPlayer then
	script.Damage:FireServer(hum, callingPlayer, anim, game.Players.LocalPlayer.Name)
end
particle:Emit()

i’ll edit this once my brain is braining again sorry :skull: wanted to update as soon as i could

ive always been questioning why the damage isnt applying as many times as there are players in the server but didnt give it much thought cause yes it was “working” :disappointed_relieved:. Now it makes sense and this just changes lots of things. Thank u for ur help @FroDev1002 :pray:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.