Getting cospaces properties from coblocks into scripts

Could somebody help me with getting Cospaces properties set in coblocks to be usable in scripts?
I already tried the: let R = Number(Space.getProperty(“R”)); to try and get the value i stored in it it from the coblocks. but it’s somehow always at zero. i dont think it’s finding the property. Here is the space CoSpaces Edu :: Grafitti its a bit messy… :sweat_smile:

1 Like

Hi @Daan_Hobbel,

Can you explain what you’re wanting to do with your CoSpace please?

You have several errors or inefficiencies in both your Script and CoBlocks:

  1. EventListeners (events) are always listening for that event - there’s no need to put them in a forever loop. Declare once, and walk away.
  2. Nested run parallel blocks - don’t nest unless you really really need to.
  3. Re-set your CoSpace Properties (in the CoBlocks) only when needed - in your case, it’s when the events happen, so put them inside the event.
  4. Do what you need to do to remove the Script error - it won’t function without this being fixed.

Hope that helps!


Hi, @techleapnz
Yeah Im still getting my footing with CoSpaces and had some trouble with the in EventListeners in another space and putting them in a forever loop seemed to fix it then but it must’ve been something else i did than :sweat_smile:.

I also fixed the parallel looping issue and brought back the property setting to a minimum.
As for the script error, that’s because of the “await” function wich is something that works but it doesnt seem to like it very much. But i dont know how to make the code delay like it does in coblocks without it.
It can be commented out for now to make the code run without any error.

The only weird thing it changes when commented out is that the color from the “shot” and the “cubie” get separated when await is not there and they both react to the shot color when it is there. Weird…

I updated my shared space with the changes.
Thanks for the advice :), but the problem still persists :confused:

So what im trying to do is:

get the cospaceproperty that i set up and manipulate in coblocks to show up in my script.
It’s in dutch but it basically makes 3 local vars and 3 global vars and assigns the local vars to the global vars anytime there is a change.

I wanna use it here to set the color of “shot” but it keeps giving me zero’s.

The purpose of the game is to be able to change te color of your graffiti using RGB values so you can click the arrows above and under the ‘R’, ‘G’ and B to change the value.

I hope that clears it up a bit

I’ve created a simple test which attempts both setting a CoSpace property in a script, and accessing from the CoBlock, and the other way around (in Scene 2) - but it also isn’t working:

@Stefan, any thoughts on why this isn’t working?


1 Like