FireAllClients() firing to only the player who uses it

I’m trying to use tools to make abilities but when I fire the tool activation from the client to the server then back to all the clients it only fires to the person who uses it but multiplies by the amount of players in the game, for example if an ability delt 10 damage and it was used and there were 5 people in the server it would deal 50 instead of 10, same goes for all the effects.

Local script:

local Remote = script:WaitForChild("RemoteEvent")
local Tool = script.Parent
local P = game.Players.LocalPlayer

Tool.Activated:Connect(function()
	Remote:FireServer()
end)

Remote.OnClientEvent:Connect(function()
	print(P.Name)
end)

Script:

local Remote = script.Parent:WaitForChild("RemoteEvent")

Remote.OnServerEvent:Connect(function()
	Remote:FireAllClients()
end)

Don’t forget to provide Player as the first argument here, it always has to include it.[On the server side]

1 Like

I tried that, doesnt really change anything

local Remote = script:WaitForChild("RemoteEvent")
local Tool = script.Parent
local P = game.Players.LocalPlayer

Tool.Activated:Connect(function()
	Remote:FireServer()
end)

Remote.OnClientEvent:Connect(function(PLAYER)
	print(PLAYER.Name)
end)
local Remote = script.Parent:WaitForChild("RemoteEvent")

Remote.OnServerEvent:Connect(function(Player)
	Remote:FireAllClients(Player)
end)

Try this

1 Like

Yeah, not working

I’ve had this issue for months now I don’t understand it

FireAllClients() does not take any player parameters. Because it’s just firing to all connected clients anyways

image
Tool layout if this helps at all

try using :FindFirstChild instead

1 Like

You need to share the remote. Currently you have the remote inside of the tool. Because of that, the event is localized to each client. The OnServerEvent script should be in the server, not the client.

1 Like

It is in the server script though

Just got errors because it couldn’t find the remote as the game started

Because each event is currently local to each client (inside of each tool) you will only get local responses to the event. You aren’t going to receive event responses from someone else’s tool in someone else’s backpack. Move the RemoteEvent somewhere both the server and all clients can access like ReplicatedStorage and ensure your server script is in ServerScriptService.

5 Likes

It worked but rest in pieces my cleanliness