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:
script.Parent.Touched:Connect(function(hit)
if (hit.Parent:FindFirstChild("Humanoid") ~= nil) then
script.Parent.Parent.CanCollide = true
elseif (hit.Parent:FindFirstChild("Humanoid") == nil) then
script.Parent.Parent.CanCollide = false
end
end)