Dude it is working perfectly its just; if the rocks are close enough it hits both of them
Then add the debounce into the rock
I did that but like I said its not working because it registers it as one click because of just how fast the event fires for both
local Rock = script.Parent
local Torso = player.Character.Torso
local Debounce = Rock.Debounce
Bindable.Event:Connect(function()
if (Torso.Position - Rock.Position) < 7 and Debounce.Value==false then
Debounce.Value=true
Rock.Health - 2
wait(1)
Debounce.Value=false
end
end)
and then in the rock add a bool value called Debounce
And is this a server side or a local script?
its a server sided script!!!
Ok then do the script I sent you with the Debounce in the rock not in the script
you can make a table and then skip the player if they are in the table and add the player if they are not in the table then damage them, here the thread: [How do I make touch events debounce for every player? - #4 by MayorGnarwhal]
You can make another kind of debounce by passing the tick into an argument and then wait until the oldtick and currenttick reach like 1sec differance or smthing this way you could sync the debounce (If your real problem is that its firing too quickly I didn’t really bother to read everything tbh.
maybe for each group of rocks, make a table, you can only hit the rock if its in the first index, after being destroyed, remove it from the table.
first create a script inside your rock and paste this:
local health = 10
local example = true
local biting = true
local respawn = math.random(10,20)
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“IsAPick”) and biting == true then
local is = hit.Parent:FindFirstChild(“Type”)
if health > 0 then
if is.Value == “Pick” then
health = health - 5
end
elseif health <= 0 and example == true then
example = false
script.Parent.Transparency = 1
script.Parent.CanCollide = false
end
end
end)
your tool should contain the following ;
It is important that you add this value to your tool
I hope it helps
you can also use tables for debounces and they dont require any string values
@lilzy7 Tried that it didnt work
@SonGoku6325 Tried that it didnt work and complicated things
@xristos10 you didnt explain it well, didnt work either
Thanks guys for the help but nothing is working
What seems to be the problem here?
it does what can you show me what you tried
Alright so basically I just decided to make the player have to be really close to the rock
show script the script to me s
no i fixed it already by just adjusting the magnitude
If that is the simple thought and it was the solution, it’s still not completely fixed for the future stuffs may break it due to some backlash, you should probably optimize the code.