Question by
Wolfrik_Creations · Jun 08, 2016 at 09:52 PM ·
javascriptplayerrpcdamagelegacy
Damage Players Using Raycast
How could I make this function work correctly? So my players set a username and on Start, it will set their GameObject name as that name. I want to have a Raycast send this:
nView.RPC("DamagePlayer", RPCMode.All, hit.transform.root.gameObject.name, ClientControls.mashCount + weapon.meleeDamage);
And then that runs this RPC
@RPC function DamagePlayer (ign : String, amount : float) {
if(gameObject.name == ign){
PlayerLife.playerAttributes.currentHealth -= amount;
}
}
So this should run for everyone, but if the username is the one I hit it should take damage, correct? Why isn't this working?
Comment