How can someone make a platform you can fall through but at the same time jump on

While looking through the internet for fun, I came across a video showcasing 3D platforming obstacles. One of these really got me interested on how it was made.

in this video made by polyhex, at the timestamp 1:34 you can see that he jumps through a platform and is still able to stand on the top of it (even though he went through it a second ago). This is very common in 2d platformers and 3d platformers as well. What I want to know is how did he make this?

I havent tried making a script for this because I don’t know what he used. It would be nice if someone explained what type of scripting he did and how I could make a script similar to the one in the video

this is my first post. Please don’t hurt me

2 Likes

I believe how this could work, is by using a Touched Event & checking if the HitPart’s Y position is greater than the Part’s position:

local Part = script.Parent

Part.Touched:Connect(function(Hit)
    if Hit:IsA("BasePart") then --Sanity check
        if Hit.Position.Y > Part.Position.Y then
            Part.CanCollide = true
        end
    end
end)

I swear we don’t bite lol

1 Like

It looks like this could work. I’m going to edit this once I test this out

it worked, but it only works once. I was trying to modify the script to work endlessly, but it just crashed studio. I’ll edit this again once I find a way for this to endlessly work

You could potentially implement a Timer for how long you want the Part to have collision on:

local Part = script.Parent
local debounce = false
local Timer = 5

Part.Touched:Connect(function(Hit)
    if Hit:IsA("BasePart") then --Sanity check
        if Hit.Position.Y > Part.Position.Y and debounce == false then
            debounce = true
            Part.CanCollide = true
            Part.Transparency = 0.5
            wait(Timer)
            debounce = false
            Part.CanCollide = false
            Part.Transparency = 0
        end
    end
end)
2 Likes

this is just a better version of what I tried to do. I’ll edit my previous post and this one if it works

holy heck, it works! This IS what I wanted to have, but my end goal for this is to be able to fall through the platform at the press of a button. With enough research, I think I can figure out how to do that. My main concern is other players being able to touch the platform you’re standing on. How can I make it so that players are able to fall down a platform without affecting the platforms on other players screen?

I cannot see post edits ree

Ah, you could put that same code inside a LocalScript in StarterPack, that way it’ll be replicated to the client only & not the server

Just be sure to parent your Part variable right

how would I do that? How does that work?

Using the same code I added earlier:

--LocalScript inside StarterPack
local Part = workspace.PartThingy --Change this to what part you want to disappear then reappear
local debounce = false
local Timer = 5

Part.Touched:Connect(function(Hit)
    if Hit:IsA("BasePart") then --Sanity check
        if Hit.Position.Y > Part.Position.Y and debounce == false then
            debounce = true
            Part.CanCollide = true
            Part.Transparency = 0.5
            wait(Timer)
            debounce = false
            Part.CanCollide = false
            Part.Transparency = 0
        end
    end
end)

that means I’ll have to add another local script per platform. It is a good solution, but in the long run, this would be a hassle to do. It’ll work for now though. I’ll attempt to fix this in the future once I expand my scripting knowledge

1 Like

after doing 10 MILLION years of research. I finally found it! I found another way to do this without having to made a whole new script everytime I make something like this! It’s called, collision group 5

Other than collision groups you could also use tags. Tags might be slightly better since there’s a limited number of collision groups so you might run out

I won’t be using these type of platforms in the game I’m making that much, so I won’t even run out, so I’m gonna stick with collision groups. I might consider using tags when I try to make a 2D game though, so can you please explain what tags do? I just found out what collision groups are, so I probably don’t know what tags are

You can tag any Instance with any tag, which is just a string. You can then get a list of all things tagged with a specific tag with a call to CollectionService:GetTagged. E.g. you might tag all your platform things with “JumpThroughPlatform” and have a single script called JumpThroughPlatformManager that looks at all these platforms and sets up the logic for how they work.

1 Like

I finally got the reply option just to reply to this post
What you can also do its that the script always checks if ALL the platforms that you have choosen are beneath the player or not:

-- Local script, it goes in any parent that handles local scripts

local HumRoot = game.Players.LocalPlayer.Character.HumanoidRootPart

for _, v in pairs([change this to the platforms folder]:GetChildren()) do -- This finds all platforms so they have the same function without adding any other script
	game["Run Service"].RenderStepped:Connect(function() -- Fires every frame, this wont lag... Unless that you spawn 10k platforms
		if HumRoot.Position.Y > v.Position.Y then -- Checks if its above the platforms
			wait(.1) -- Cooldown, player could get stuck in the middle of the platform if this gets removed
			v.CanCollide = true -- The "v" are the platforms btw
		else -- Checks if its beneath the platforms
			v.CanCollide = false
		end
	end)
end
5 Likes

I have completely moved on from this post, grew as both a person and deveoper, and even though of my own solutions to this problem(that I haven’t tried yet), but I have never thought of something like this. Thank you!

2 Likes

Well what can I say, you spent 2 years or less of research just to encounter some random guy who made the one-way platform in less than 10 minutes

No problem!
But for real, you made my night dude, that was the first reply and post I’ve ever made, and it was taken by a solution almost immediately it got readed.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.