How do i make floors invisible using a local script?

I want to make a code so if the player enters the first floor the second and third floor disappears
and if the player is on the staircase the second floor reappears etc

You could either do this with:

  • Touched

  • Region3

I’ll let you decide lol, but I’ll only give an example

I think I will go with Touched

What you could do, is create a couple of invisible boundaries inside the individual floors itself, then depending on what floor/staircase you’re on you can set them invisible/visible

Maybe something like this? I’m not sure how Region3 could work in this Instance, but you’d probably need to use a lot of them:

local CurrentFloor = workspace.Floors.Floor1
local CurrentStair = workspace.Floors.Staircase1

CurrentFloor.Touched:Connect(function(Hit)
    for _, Floor in pairs(workspace.Floors:GetChildren()) do
        if Floor.Name ~= CurrentFloor.Name or Floor.Name ~= CurrentStair.Name then
            Floor.Transparency = 1
        else
            Floor.Transparency = 0
        end
    end
end)

The scenario you’re going for might be a bit difficult

Can you please make a version of this code with invisible boundries
because i dont think this works now :confused: :confused: :thinking:

i would say make an invis part with a script in saying

script.Parent.Touched:Connect(function()
Local Floor1 = Workspace.Folder:GetChildren() --gets the parts
Floor1.Transparency = 1
end)

not sure if it would work but possibly, im pretty new to lua so