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

OnServerInvoke is not a valid member of RemoteEvent?

Asked by 4 years ago
Edited 4 years ago

Hello, I'm Making a JoJo game and I stumbled upon a little error in my script: OnServerInvoke is not a valid member of RemoteEvent. I'm using a RemoteFunction but it does this error, I really don't understand what's the problem.

local ArrowEvent = game:GetService("ReplicatedStorage").Logic.arrowevent

ArrowEvent.OnServerInvoke = function(Player,Arrow,Character,action,hitpos)
    -- My Code
end

This is a server script.

Proof that it's in the right spot: https://imgur.com/a/DPOFU5N

Help Would Be Really Appreciated

0
check this video out by alvin blox on how to make it work https://www.youtube.com/watch?v=-KqiPiE5P74&t=1014s Gameplayer365247v2 1055 — 4y
0
Are you invoking the function from client to server or server to client? If client to server, are you using a Localscript to invoke on a server script? (Vice versa for the latter) BuDeep 214 — 4y
0
There is not enough information to determine anything other than that ArrowEvent is not the RemoteFunction in the picture. 1waffle1 2908 — 4y

3 answers

Log in to vote
0
Answered by 4 years ago

Remote events use .OnServerEvent ArrowEvent.OnServerEvent:Connect(function(Parameters) --Your code end)

0
I'm using a RemoteFunction bruh MajinBluee 80 — 4y
0
Your question says "RemoteEvent" bruh BlueGrovyle 278 — 4y
0
Not to mention, if the error message says "RemoteEvent", that means you made a mistake and are indeed using a RemoteEvent instead of a RemoteFunction. BlueGrovyle 278 — 4y
0
But look at the picture, It's a RemoteFunction MajinBluee 80 — 4y
Ad
Log in to vote
-1
Answered by
2ndwann 131
4 years ago

Use :Connect, not an assignment operator for a RemoteEvent.

Here is the fixed code:

local ArrowEvent = game:GetService("ReplicatedStorage").Logic.arrowevent

ArrowEvent.OnServerInvoke:Connect(function(Player,Arrow,Character,action,hitpos)
    -- My Code
end)

I hope this helps!

0
Doesn't work .-. MajinBluee 80 — 4y
0
OnServerInvoke is a callback of RemoteFunctions. OnServerEvent is an event of RemoteEvents. 1waffle1 2908 — 4y
Log in to vote
-1
Answered by 4 years ago

Maybe the script loaded before the RemoteFunction so, at that time it didn't exist.

local ArrowEvent = game:GetService("ReplicatedStorage").WaitForChild:("Logic").arrowevent

ArrowEvent.OnServerInvoke = function(Player,Arrow,Character,action,hitpos)
    -- My Code
end
0
Doesn't work .-. MajinBluee 80 — 4y

Answer this question