Platform Compatibility
PC | Mac OSX | Oculus Quest |
---|---|---|
X | X | X |
This is an example of how to clone an object with SpecialFX tag when clicking the object the script is attached to.
For further reading, look at Tags, tryStore, Timers, and cloneObject!
1 2 3 4 5 6 7 8 9 10 11 12 | --Clone an object tagged with "SpecialFX" at the base of the object this script is attached to --This also uses a 1.0s cooldown timer before another can be spawned obj.setTimer("cooldown", 1.0, "") local original = obj.tryStore("SpecialFX") function onClick(type) if obj.timerDone("cooldown") then obj.cloneObject(original, obj.getX(), obj.getY(), obj.getZ()) obj.resetTimer("cooldown") end end |