Simultaneous Hits Problem

I have this rock system and the player can hit the rocks and stuff but problem is that, the player can hit two rocks at the same time and damage them both which I dont want

Ive tried a debounce and that didnt work; I also tried a check to see if the players is already hitting a rock but thats no use because I cant really differentiate between the rocks and magnitude really isnt ideal in this case

If someone knows a way I can possibly check or some other way itd be rad thanks

2 Likes

You could make a value of some sort inside of the player that allows you to identify if they’ve been hit by a rock (depending on if this is strictly serversided/local)

Wait what? The rock is not hitting the player; the player is the one hitting the rock

And even then if Im hitting them both at the same time how can i possibly differentiate?

Can we see the script. There should be a way to use Debounces to fix it.

Sorry, I mixed up words. The basis is still the same though.
If the value is, say, true, dont deal damage to the player

See like I cant do that if there are two rocks close enough to each other;

Can we see the script so we can see what the problem might be?

Its not a problem with the script though; its just a bug Im needing to fix so Im asking if theres any way i can possibly check which rock the player hit so they can stop hitting the other one but I cant even fathom how to do that if the player hits both the rocks at the exact same time

Like @lanjtlike said maybe put a bool value inside of the player saying they have been hit.

But its not the player getting hit; its the rock and even if I put a bool value inside of the rock it will be in both rocks the player hits

1 Like

Make it so when the player hits the rock it sets a bool value in the rock to true saying someone is already hitting the rock.

and even if I put a bool value inside of the rock it will be in both that the player hits

What? You should only have one BoolValue inside one rock that changes based on if a player touches it…

Seeing your script would really help. There are many ways you could be doing your system so knowing the script could allow us to help more.

Its not that I dont want two players to be able to not hit the rock; i dont want the same player being able ot hit two rocks at the same time

But even then if the player is close to both rocks and hits them itll change it for both…

Then use a debounce, please show your script maybe that might help?

Its pretty straight forward I have a bindable event inside of the rock and when my axe or whatever is close enough to hit it; it fire the bindable event and then deals damage simple as that

I tried a debounce and that didnt work as intended

But there is no debounce and that is why its doubling.

Can I see your code with the debounce?