How to disable remove when item clicked event from (Item)

I wanted to know if there was a way to disable the Remove when item clicked event code after a couple of seconds have past is that possible?

Hi @JohnSpace,

You can use “Remove when item click” CoBlock from Events Category

I don’t have the option to put it in no items I’m trying to disable the remove when item clicked after a couple of seconds so that I can click on the item again

Try this code, but swap out the cuboid with your item:

Hope that helps!!

1 Like

Hi @JohnSpace,

Judging from the posts above, we’re not entirely clear on what you’re trying to achieve.

Could you share the code you’re using by selecting the part that’s causing you problems and right-clicking and selecting Save as Image, or allow your project to be remixed and share the link, so that we can see the context for your description, and suggest appropriate solutions?

Geoff @ TechLeap

Sorry about that I’m not sure how to explain it go to scene 3 I’m trying to make a turn based rpg game CoSpaces Edu :: Tom's Mysterious Rpg Adventure (Test) I wanna make it so that when I click on fight it will activate the remove when item clicked event code then after a couple of seconds it will deactivate the remove when item clicked event code

I’ll go try that out (Also if you don’t understand what I mean here is a link) CoSpaces Edu :: Tom’s Mysterious Rpg Adventure (Test)

Do you just want to deactivate the button while the action is taking place? In other platforms I have achieved button activate and deactivate using a Boolean (True/False) variable. Set ‘buttonClickable’ to true on start.
If (buttonClickable == true)
{When clicked
buttonClickable= false;
//do function;
Then set the buttonClickable back to true whenever you want it clickable again either after a set time or when the other actions are completed.

Is that what you were thinking?

You could create a function that initialises the onClick event. And schedule this function call when the event was disposed.

function setOnClick() {
    //your onclick logic
    Time.schedule(setOnClick, 2)

1 Like

I think yes that is correct let me try it

Wait how do I set a timer with scripting I haven’t really learned that yet

let time = 10;
let timeDisplay = Scene.getItem("Item ID Here") as Text;
timeDisplay.Text = "Time: " + time;

        if (time = 0){
             timeDisplay.Text = "Time is up!"

          time -= 1;
          timeDisplay.Text = "Time: " + time;}, 

Function schedule executes a function after a delay in seconds.

  /*your code here*/
}, delay);