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

Error with my Event?

Asked by
Relatch 550 Moderation Voter
10 years ago

Please include the code which you are trying to use, so the community will be better-equipped to help you with your problem.

Error: 14:19:08.441 - ReplicatedStorage.RemoteEvent: OnClientEvent can only be used on the client

This is used in my script. Is OnClientEvent right?

2
Post the script 1waffle1 2908 — 10y
0
event.OnClientEvent:connect(function(...) Relatch 550 — 10y

1 answer

Log in to vote
2
Answered by 10 years ago

If you're using OnClientEvent be sure that you're using a local script. OnClientEvent fires when FireClient or FireAllClients is called from the server.

An example of what this interaction would look like:

--Server
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
RemoteEvent:FireAllClients("Howdy")

--Client (local script)
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
RemoteEvent.OnClientEvent:connect(function(arg)
    print(arg)
end)

This guide may also be useful if you need to know more: http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial

0
Can I give you a line of my script and let you look at it? Relatch 550 — 10y
0
event.OnClientEvent:connect(function(...) Relatch 550 — 10y
0
That line itself is correct, but without any context or script I can't say that the rest works. MrgamesNwatch 65 — 10y
Ad

Answer this question