A little help with spleef floor cracking

I would like to make the floor crack a little when touched and when touched again it will fully break

I want to make it so that the touch event has a debounce however instead if individually applying to every part the debounce is applying to every single part at once making things delayed

Though there are many people also making spleef games none of them seem to be attempting the same thing i am

here is the code
image

Probably because of touched event multi firing

thats what i would like it to do
i want it to be able to register if any part is being touched if it is itll crack a little
if touched again itll break
its doing what i want however it is delayed
i assume this is because of the wait(.5) that i put in however if i dont put this the bricks will break immediately with no debounce

I believe its because once any brick is touched, it enables the cooldown for every single brick, therefore other bricks will be delayed since the cooldown is enabled,
(this might not be the best approach, but its something that you can try)
place a BoolValue into every block (make sure it starts off false), and make the script enable that value when that brick is touched, and disable it 0.5 seconds afterwards, and check if that boolvalue is false in order for the touching to work.
(if you dont exactly understand, i can explain it in a better way)

3 Likes

Summarized: use a boolValue of each part to debounce

i think i understand what you mean but i have a question

i tried somthing like this and i added a new value to every block
however when i attempted to play i told me the value was not a valid part of the block

Yes, i was just explaining it in more detail of how to create it

then use :WaitForChild since the script probably ran before the values fully loaded in.

Create a bool value in your parts loop then save it to a variable so you dont have to physically create them

It wouldnt be that hard to create them physically, You just make one, and copy and paste it.
Also, it might be a little bit slower since the server has to manually create one for all of those bricks.

like this?

Wasn’t exactly what i meant, but you can try that.
(obviously you’d have to make it turn back on after 0.5 seconds)
Also, you dont have to put the “And v.CanTouch == true” check since the Touched event only works if that value is true.

1 Like

tysm its working quite well now

Im glad it worked! good luck with your game!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.