Help of falling platform

I’m trying to make a platform that falls when you step on it. The programming seems fine to me, but when I start it, it is redirected to axis 0. I don’t know what else to do.

can i see the code to see where the code went wrong?

Of course, here is the platform code:

extends AnimatableBody2D

@onready var Anim := $Anim as AnimationPlayer
@onready var Respawn_timer := $Respawn_timer as Timer
@onready var Respawn_position := global_position

@export var Reset_timer := 3.0

var Velocity := Vector2.ZERO
var Gravity = ProjectSettings.get_setting(“physics/2d/default_gravity”)
var is_triggered := false

Called when the node enters the scene tree for the first time.

func _ready():
set_physics_process(false)

Called every frame. ‘delta’ is the elapsed time since the previous frame.

func _physics_process(delta):
Velocity.y += Gravity * delta
position += Velocity * delta

func has_collided_with(collision: KinematicCollision2D, collider: CharacterBody2D):
if !is_triggered:
is_triggered = true
Anim.play(“Shake”)
Velocity = Vector2.ZERO

func _on_anim_animation_finished(anim_name):
set_physics_process(true)

Fyi the Kenney platformer starter pack is in the asset tab in the editor and has falling platforms.

Kenney is awesome and makes free assets.

It is 3d, but might have something pointing you in the right direction.

I managed to ‘fix’ the issue of the platform starting at position 0 by removing the platform’s reset animation, but now when the player collides with it, both the player and the platform go to position 0. Does anyone know what could be causing this?