How would I make these kind of 2D platforms?

Currently in my 2D platformer I want to make it so if there’s a platform above you, you’re able to go through it. But once you’re on top of the platform, it’s collideable again. Here’s what I’m talking about:

I’ve tried doing this myself but it keeps breaking somehow:

And the code for it:

	if (hit.Parent:FindFirstChild("Humanoid") ~= nil) then
		script.Parent.Parent.CanCollide = true
	elseif (hit.Parent:FindFirstChild("Humanoid") == nil) then
		script.Parent.Parent.CanCollide = false

You could implement a wait() delay, then make the Part’s colission set to true? (Although I’d recommend setting a debounce)

You can simply check if the player is below the platform or not.

if player.Position.y < platform.Position.y then
    platform.CanCollide = false
    platform.CanCollide = true
1 Like