Hey guys! So, I’ve been working with PUN for a while now, but whatever I do, I can’t seem to get shooting to work. The problem is (by the title) that players can’t shoot each other, and I have no idea why! But all I DO know is this: When a player shoots, they do detect shooting other players. When the player shoots another player, it get’s a script on the other player and calls a function that deals damage to that player. Well, I use getComponent to get that script, but when I shoot, the GetComponent doesn’t go through! In other words, for some reason I can’t access the script! Here’s my code to do the damage on the local player: pastemyst | (untitled) And my code to take damage on the other players: https://paste.myst.rs/vvw Any help would MUCH appreciated. Thanks!
Please add debug.Logs in your shooting logic to see which object you actually hit. I guess you just have to replace all
objectHit.transform.root to make sure that whereever you hit the other player you will always access the same transform on them.
If this does not help please report back and post some more info about what you hit, how your hierarchy setup is with colliders and please make really really sure the raycast does not get stuck in your own player…