Firing remote problems

Value doesn’t increase when it’s being used by another player here’s the tool script for increasing values.

local player = game.Players.LocalPlayer
local tool = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("s")

tool.Activated:Connect(function()
    event:FireServer(player)
    end)

And here is the remote script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("s")
local cd = false

event.OnServerEvent:Connect(function(player)
    if cd == false then
        cd = true 
        player.s.Value += 1 
        wait(1.5)
        cd = false
    end
end)

don’t use FireServer(player)
rather just say FireServer()

Hi, the script seems fine, but you don’t need to provide the player in FireServer() because the first parameter in OnServerEvent is the player that fired the remote event.

Is there also some error in the output?

No error logs, the problem is that it seems like whenever the remote is already being fired by another player it doesn’t work for anyone else, so if for example I’m using the tool, the value only increases for me, while it doesn’t work for anyone else until I stop using the tool. Apologies if I wasn’t clear enough in the op.

Just tried this but it didn’t fix the issue.

This is probably the problem. When a player fires the RemoteEvent, it sets the variable’s value to true then waits 1.5 seconds and sets it to false again.
The problem with that is when another player fires it while the variable is still true, nothing happens.

You can use a table so it doesn’t affect all players.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("s")
local CooldownTable = {}

game.Players.PlayerAdded:Connect(function(player)
	local s = Instance.new("IntValue", player)
	s.Name = "s"
end)

event.OnServerEvent:Connect(function(player)
	if not table.find(CooldownTable, player.UserId) then
		table.insert(CooldownTable, player.UserId)
		player.s.Value += 1 
		wait(1.5)
		table.remove(CooldownTable, table.find(CooldownTable, player.UserId))
	end
end)

try this:

local tool = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("s")
local Cooldown =  false


tool.Activated:Connect(function()
	if Cooldown == false then
		event:FireServer()
		Cooldown = true
		wait(1.5)
		Cooldown = false
	end
end)

I tried this but the script now only seems to fire once and then never again, value never increases beyond the first time it’s fired.

I’m hesitant to try this because it could be very easily exploited via a cooldown breaker script. is there any way I can move this to the serverscript?

Oh I fixed it now, it was just a problem with the script.

After updating it now works ty!