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)
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)
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.
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.