#Multiplayer call function locally

12 messages · Page 1 of 1 (latest)

tiny heath
#

On my player script I have onDeath local function, and I have the peerId of the killer. How can I call the local function onKill on the killer?

granite hearth
tiny heath
#

that isn't working, it says its not the authority, and isn't called on the player (resulting errors from my code):

@rpc("call_local")
func onKill():
    print(is_multiplayer_authority()) # false
granite hearth
#

are all the players clients ? Or is one of them the server ?

tiny heath
#

The server is also a player

granite hearth
#

wait, I'm an idiot, you don't need the "call_local" if it's always called from an other player

#

just make it a basic rpc function

#

technically, nothing requires the onKill method to be local so if it's a basic rpc method that you call from the killed player, everything should work fine

abstract moat
#

FYI, depending on the competitiveness of what you are building and client-side authority, it'll be important to still validate the interactions to reduce the chance of cheating.

tiny heath
#

so can you recap, how should the function look and called?

tiny heath
tiny heath
#

For example, I want to call am animation on kill and it's locally.
The nodes of the hud are freed on the remote players