I am making a top down shooter and when the player walks in a room with a ceiling, I want the ceiling to go transparent and when the player walks out the ceiling should go back to opaque.
The current camera script looks like this:
local currentCamera = workspace.CurrentCamera local offset = Vector3.new(-0.01,30,0) local player = game.Players.LocalPlayer local lobbyactive = game:GetService("ReplicatedStorage").Values.LobbyActive local updateCameraEvent = game.ReplicatedStorage.Events.UpdateCamera local mode = "lobby" player.CharacterAdded:Wait() player.Character:WaitForChild("HumanoidRootPart") local humRoot = player.Character:WaitForChild("HumanoidRootPart") currentCamera.CameraSubject = humRoot currentCamera.CameraType = Enum.CameraType.Scriptable currentCamera.FieldOfView = 90 updateCameraEvent.OnClientEvent:Connect(function() if lobbyactive.Value == true then mode = "lobby" elseif lobbyactive.Value == false then mode = "game" end end) game:GetService('RunService').Stepped:Connect(function() if mode == "lobby" then currentCamera.CFrame = CFrame.new(workspace.CameraPart.Position, Vector3.new(0,0,0)) elseif mode == "game" then currentCamera.CFrame = CFrame.new((humRoot.Position + offset), humRoot.Position) end end)
I also already have the DevCameraOcclusionMode set to invisicam but it doesn't work :/
I have also tried to use a raycast but once the part is invisible it doesn't change back.