Basically, I want to remake the tablet from doors so I can try put it in my game, so I need night vision and highlighting tools, but only through the screen.
I don’t know how to do this since it is complicated.
Can someone give me a push in the right direction?
3 Likes
How would I get the night vision working?
1 Like
The Ambient property colors the scene in the ViewportFrame and can also brighten it similar to how night vision brightens an area. Try bright white or green Ambient values with a dark scene.
Hi! I have a problem, the viewport frame is not working… can you help?
local generatedRooms = workspace:WaitForChild("GeneratedRooms")
local startRoom = generatedRooms:WaitForChild("StartRoom")
local frame = script.Parent
local runService = game:GetService("RunService")
local camera = Instance.new("Camera", script.Parent)
startRoom:Clone().Parent = script.Parent
runService.Heartbeat:Connect(function()
script.Parent.StartRoom:PivotTo(startRoom:GetPivot())
frame.CurrentCamera = camera
camera.CFrame = script.Parent.Parent.Parent.CFrame
camera.Focus = workspace.Camera.Focus
camera.CameraSubject = script.Parent.Parent.Parent
end)
1 Like
This script repeatedly using a chain of Parent calls. It’s unclear what it refers to without proper variables or a screenshot of the explorer structure of this system. Please revise your code so whatever it’s accessing is apparent. Also, what are you attempting to accomplish here?
I am copying the start room to the viewport frame, and setting the CFrame of the camera to the CFrame of the part, also I’m just adding other necessary values
What does the ViewportFrame look like in-game? Is the LookVector of the tablet pointing out of where you’d expect the lens of the night vision tablet to be? Is StartRoom detailed enough that a camera pointed anywhere in the room won’t have its entire field of view not obstructed by walls?
Minor note, CameraSubject does nothing here and CurrentCamera only needs to set once if you always use that camera.
test model
it looks like this, with no frame (backgroundtransparency = 0)
surfacegui
viewport frame
1 Like
Can you set the adornee to the Part as well? After you do that, can you see if UI objects other than ViewportFrame show on the SurfaceGui?
the adornee is set
normal frame
hold on lemme try a local script
1 Like
ok so doing it locally works for some reson
I’m glad. Camera logic doesn’t really work on the server, so it usually is a client-only thing. Are there any issues with brightness? Make sure to update which room is shown as players change rooms.
Brightness is fine, just need to add a few animations, and change the room, and we’re all set! Thanks for helping!
1 Like
Hold up, there is a problem, the frame only updates when I unequip and re-equip. Do you know why this happens?
Is the LocalScript under the tool? Tools notoriously mess with how they run when unequipped. Are you saying that whenever you re-equip, the scene updates once and not again until it’s re-equipped?
If you’re moving the script to another more reliable location, make sure it only runs if the player has the tablet out and keep a flexible reference of the tablet so it doesn’t break on respawn.
Good call, let me try moving the script to StarterGui.
After moving the scripts, it appears that the camera does update every frame, however the viewport does not.
Does the script properly keep references to the ViewportFrame? How are you confirming if the ViewportFrame changes?