RemoteEvent not working

Hello.

I’m currently experimenting with RemoteEvents via mouse inputs and I’ve been stuck on something for a while: when I press the mouse button I assigned to the script, the RemoteEvent fires, but doesn’t return anything.

Clientside:

local Mouse = game.Players.LocalPlayer:GetMouse()
local debounce = false
local canresetcombo = false
local CurrentM1 = 1
local M1Event = game.ReplicatedStorage.Combat.M1Pressed

Mouse.Button1Down:Connect(function()
    if not debounce then
        debounce = true
        M1Event:FireServer(CurrentM1)
        print("fired")
        wait(0.3)
        debounce = false
    end
end)

Serverside:

local M1Event = script.Parent.M1Pressed

M1Event.OnServerEvent:Connect(function(plr, combo)
    print(plr)
end)

I checked time and time again if the RemoteEvent exists for both parties, it does.

It’s supposed to output the player who clicked, but the only thing that the console outputs is the print statement in the Clientside.

Any suggestions?

Server (and local) scripts don’t run in ReplicatedStorage, which is why the server script isn’t receiving anything. Try moving the server script to ServerScriptService, then try again.

1 Like

Oh, thanks for making me remember.

So I was torturing myself by figuring out something as simple as that, oh well.

Sometimes I tend to forget that scripts have that behaviour for some reason.

1 Like

That’s okay, glad I could help!