Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why won't my remote event fire the client when fired on the server?

Asked by 5 years ago
Edited 5 years ago
--Server script

local function fireClientCreateClickDetectors()
    print("Click Detectors Added")
    for i,v in pairs(plrs) do
        createClickDetectors:FireClient(v)
    end
end

fireClientCreateClickDetectors()


--Local script

local function onCreateClickDetectorsFired()
    print("Create Click Detectors Event Fired")
    addClickDetectors()
end

createClickDetectors.OnClientEvent:Connect(onCreateClickDetectorsFired)

Whenever I fire the client in the server script, nothing happens client side. The server print works but of course the local script doesn't print anything because it seems it was never fired. I should say that I'm aware that I could use FireAllClients() instead of the method that I used in the server script, but I did it this way because I'm going to have multiple games going on in a server and I'm going to have different player tables for each game. Also, I had it as FireAllClients originally and it still didn't work, so I don't think that's the problem. I'm completely stumped as to why it won't work, am I missing something really obvious?

Also also, no errors are thrown in the output.

0
are you writing your events properly? DreamInspired 61 — 5y
0
Yes, the variable is correct if that's what you mean. Also the local script is stored in the player's character, so the problem isn't that the local script isn't running. GuruNin 5 — 5y
0
Try converting onCreateClickDetectorsFired to an anonymous function. In theory it shouldn't make a difference, but I'm as confused as you are. SlimeMan22 60 — 5y
0
Where are you placing your RemoteEvent? Spiritation 0 — 5y
View all comments (2 more)
0
Make sure to put it in ReplicatedStorage, since then both the server AND client can see it. Spiritation 0 — 5y
0
Yes yes, the event is in replicated storage. GuruNin 5 — 5y

Answer this question