Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get the player's camera to not go through transparency 1 bricks?

Asked by 5 years ago
Edited 5 years ago

I have a problem were I have a invisible door that goes into a room with a click-to-give uniform. The camera can go through the door, even with the group-only door script. I want the door to remain transparency 1 but make it so the camera can't go through it, any ideas? Door script I use is below on a transparency 1 part.

01local rank = 47 -- The rank the player will need to get through (out of 255)
02local groupID = 4957909 -- The group ID the player must be in
03 
04script.Parent.Touched:connect(function(hit)
05if (hit and hit.Parent and game.Players:FindFirstChild(hit.Parent.Name)) then
06    if (game.Players[hit.Parent.Name]:IsInGroup(groupID) and        game.Players[hit.Parent.Name]:GetRankInGroup(groupID) >= rank) then
07            script.Parent.CanCollide = false
08            script.Parent.Transparency = 1
09            wait(1)
10            script.Parent.CanCollide = true
11            script.Parent.Transparency = 1
12        else
13            script.Parent.CanCollide = true
14        end
15    end
16end)
0
Is CanCollide off for the door? Make sure it's toggled ON, on ALL parts associated with the door model. BryanFehr 133 — 5y
0
@BryanFehr CanColide is set to true and you can still leak the camera through the door. charrybomb -3 — 5y
0
If the door is set higher than 0.2 transparency, the camera can go through the door. Anything less than 0.2 transparency will make it so that the camera cannot go through it. I want the brick to have 1 transparency at all times without the camera going through it. charrybomb -3 — 5y
0
So if your gonna do this, make sure you duplicated the part, insert a normal mesh in it and set it's scale all to 0, and you're done. Use it on your main part as its easier. notfenv 171 — 5y

2 answers

Log in to vote
0
Answered by
notfenv 171
5 years ago

So if your gonna do this, make sure you duplicated the part, insert a normal mesh in it and set it's scale all to 0, and you're done. Use it on your main part as its easier.

Ad
Log in to vote
0
Answered by 5 years ago

If you override the Popper script's canOcclude function, you can tell it to occlude (have the camera not pass through) whatever you want. For instance, you could remove the part where it checks if the part's transparency is less than .25 or .95

See https://developer.roblox.com/articles/Movement-and-camera-controls for the basic idea of overriding scripts.

The Popper script is in PlayerScripts.PlayerModule.CameraModule.ZoomController.Popper

  • Go into play solo
  • Copy the PlayerModule script (in StarterPlayer.StarterPlayerScripts)
  • End play solo
  • Paste the PlayerModule script (with all its descendants) back into the StarterPlayerScripts folder
  • Make the changes to the Popper script (remove part.Transparency < 0.25 and and part.Transparency < 0.95 and in the function that starts on line 124) OR have it check to see if it's the special door you're interested in, like:
01local specialDoor = workspace.SpecialDoor
02local function canOcclude(part)
03    -- Occluders must be:
04    -- 1. Opaque
05    -- 2. Interactable
06    -- 3. Not in the same assembly as the subject
07 
08    if part == specialDoor then return true end
09    if FFlagUserPoppercamLooseOpacityThreshold then
10        return
11            part.Transparency < 0.25 and
12            part.CanCollide and
13            subjectRoot ~= (part:GetRootPart() or part) and
14            not part:IsA('TrussPart')
15    else
View all 21 lines...

(In the above script, that's the default canOcclude function, but I added the 2 lines that have 'specialDoor' in them.)

Answer this question