Please help! the buttons are working but i do not understand why the game can't collect or get killed in the next scene

https://playcanvas.com/editor/scene/1133845

here is my file link

what code should be placed in the button or in the game to make it work! attached here is also the video of this error

thank you for the help

I don’t see the error?

check this video^

the game is working but is not able to collect coins, and dye

That looks like a logic issue where the collision event is not being listened to and destroying the coins.

From the documentation, you can track which events are fired on which component: https://developer.playcanvas.com/en/api/pc.CollisionComponent.html

In this case, collisionStart is on the rigidbody, not the collision as done in your code.

so what code am i missing for this to work? im not exactly sure what to do

Actually, I’m wrong. Ignore my last message.

I’m playing the game scene and it looks like I’m collecting the coins fine

yes the game is fine its just the transition of the button when launch the start scene the game can’t collect the coins or die

is there a certain code that i am missing?

Looking at your scene loading code, it looks like you are using LoadScene which doesn’t initialise the scripts.

Check the code in https://developer.playcanvas.com/en/tutorials/switch-full-scene/

ChangingScenes.prototype.loadScene = function (sceneName) {
    // Get a reference to the scene's root object
    var oldHierarchy = this.app.root.findByName ('Root');
    
    // Get the path to the scene
    var scene = this.app.scenes.find(sceneName);
    
    // Load the scenes entity hierarchy
    this.app.scenes.loadScene(scene.url, function (err, scene) {
        if (!err) {
            oldHierarchy.destroy();
            pc.ComponentSystem.initialize(scene.root);
            pc.ComponentSystem.postInitialize(scene.root);
        } else {
            console.error(err);
        }
    });
}

However

This approach is generally not recommended as it relies on private API and would suggest to use https://developer.playcanvas.com/en/api/pc.SceneRegistry.html#loadSceneHierarchy instead as shown here: https://developer.playcanvas.com/en/tutorials/changing-scenes/

will try this and update you if working thank you,

also under what scene should this code be?

im very confuse

Any where you have code for changing scenes