Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ThatOneGuyNamedJoe |
I have two scripts, one is a player and the other is a lever. I want the player script to send a signal to a raycast’s collider telling it to adjust a value but the value isn’t affected. I have little understanding of how multiplayer works and followed a tutorial to setup multiplayer. I believe the player is controlled by the peer and the lever is ran by the host.
Player script:
func _unhandled_input(event: InputEvent) -> void:
if not is_multiplayer_authority(): return
if Input.is_action_pressed("interact_1"):
if interactRayCast.is_colliding():
var collider = interactRayCast.get_collider()
collider.rpc("interact", self, 1)
if Input.is_action_pressed("interact_2"):
if interactRayCast.is_colliding():
var collider = interactRayCast.get_collider()
collider.rpc("interact", self, 2)
lever script:
@rpc func interact(_player, type):
if type == 1:
value += 5
else:
value -= 5
value = clamp(value, -25, 25)
Can anyone please explain to my why this isn’t working? Thanks in advance.