Error: 14:19:08.441 - ReplicatedStorage.RemoteEvent: OnClientEvent can only be used on the client
This is used in my script. Is OnClientEvent right?
Error: 14:19:08.441 - ReplicatedStorage.RemoteEvent: OnClientEvent can only be used on the client
This is used in my script. Is OnClientEvent right?
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
Can I give you a line of my script and let you look at it?
event.OnClientEvent:connect(function(...)
That line itself is correct, but without any context or script I can't say that the rest works.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Post the script
event.OnClientEvent:connect(function(...)