Need help on a game

I’m trying to make a game where a ball (player) can move and dodge platforms but when the platforms are moving up they are just letting the player through while when its not moving the player cannot pass through. I want the player to be able to move up with the platform when on top of it without having to touch the move keys

Just to clarify something, you mean platforms that basically act like elevators? For a moment when you said they let the player through, I thought you meant the ball can go through the platform, but you mean they raise the ball up only when they’re moving, right?

so yea like an elevator and i already made it to where the ball (player) cant move through it when its not moving but then for some reason when it is moving the ball just goes right through the platform when i want it to act more like an elevator

do u use gravity in ur game? Or is it a move in all directions type?

i haven’t thought about the gravity but also how do I do that sry again im new to coding so you will prob see a lot of questions from me

It’s okay, ask as many as u need. You might need to create a something and call it gravity. So go to the default script, and type “project.gravity=0;” then go to the player and type in the update script this:

this.y-=gravity;
project.gravity- -;


Then go to a platform, and type this in the update script:

if(this.hitTest(player)){
if(isKeyDown(‘up’)){
project.gravity=15;}else{
project.gravity=0;
}


ok thank you again ill go do that real quick

no problem, as u create more projects, coding would get easier

ok I tried to what the problem was but on this.y-=gravity; keeps saying that there is an error on that line and I’ve done everything else for it (error is unexpected token)

Unexpected token usually means you’re just missing a bracket or have an extra bracket. Try to check all of your if statements and make sure you have the right number of closing and opening brackets. What you want to look for is something like this:
if(condition===true){
code goes here
}
}
(Notice the extra bracket at the end)

ok thanks ill tell you if it works

so i checked to see if it was the bracket and it seems like its not that because its still not working

The error report should tell you what line the error is happening on, you can try copy-pasting that line here and I could look it over if you want?

i just got it to work " " was missing on the command

Nah, I just checked my code (I probably should’ve checked it before),
the error is because I had y-=gravity instead of project. gravity! Just change that line to this:

this.y-=project.gravity;


sorry for that confusion