I’m sure most of you of played (or heard) of the Roblox Snapchat game. I played it, and I’m really wondering how it is done. I thought maybe with ViewportFrames, but then I read a post made by Roblox talking about CaptureService, which doesn’t seem to be fully released yet.
So how exactly would I go about doing this? If you think you can answer, please let me know! Thank you and have a wonderful day!
I thought about doing this for a horror game, but you can’t take pictures. You use it as a way to look inside rooms and hallways to see where the monsters are.
Would you possibly be able to help me achieve this?
What I want is whenever you equip a certain tool it enables the ViewportFrame so you can move it to view the areas around you. So say you’re coming up to a hallway and you don’t want to go down it yet. You equip this tool and move the camera in the frame so you can look down the hallway without getting in any possbile monsters eyesight. Does that make sense?
The video was very helpful! I’ve seen videos by this guy before and they’ve been very informative.
The problem with mine is that any clothes on my avatar don’t replicate. Is there anyway to fix that? Also, how do I make it where the frame updates in real-time. So if I jump, I see it in my ViewportFrame.
Do they not only replicate in the ViewportFrame or do they just not replicate overall?
I don’t think that updating the ViewportFrame every single time the player moves is kinda dumb. What you could do is detect when you jump and then just use a Body Mover and make your character move up
Mb I meant like AlignOrientation and AlignPosition
Hm there’s a function I’m pretty sure that gets the clothing ids and then you can apply them with another function… found em now
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid, HumanoidRootPart = Character:WaitForChild("Humanoid"), Character:WaitForChild("HumanoidRootPart")
-- ur code
local Desc = Humanoid:GetHumanoidDescriptionFromUserId(Player.UserId)
Humanoid:ApplyDescription(Desc)
Players.TabbyCat904.PlayerGui.SurfaceGui.LocalScript:28: attempt to index nil with 'GetHumanoidDescriptionFromUserId'
Here is my code:
local Gui = script.Parent
local ViewportCamera = Instance.new("Camera")
ViewportCamera.CFrame = Gui.Adornee.CFrame
ViewportCamera.FieldOfView = 80
Gui.ViewportFrame.CurrentCamera = ViewportCamera
local DetectZone: BasePart = Gui.Adornee.Parent.DetectionZone
local Prompt: ProximityPrompt = Gui.Adornee.Attachment.ProximityPrompt
local debounce = false
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid: Humanoid, HumanoidRootPart = Character:FindFirstChildWhichIsA("Humanoid"), Character:WaitForChild("HumanoidRootPart")
Prompt.Triggered:Connect(function()
if debounce == true then return end
debounce = true
Prompt.Enabled = false
Gui.ViewportFrame:ClearAllChildren()
task.wait(1)
local Parts = workspace:GetPartBoundsInBox(DetectZone.CFrame, DetectZone.Size)
for _, part in Parts do
local PartClone = part:Clone()
PartClone.Parent = Gui.ViewportFrame
local Desc = Humanoid:GetHumanoidDescriptionFromUserId(Player.UserId)
Humanoid:ApplyDescription(Desc)
end
Prompt.Enabled = true
debounce = false
end)
-- added type checks since you seem to prefer them
local Players: Players = game:GetService("Players")
local Desc: HumanoidDescription = Players:GetHumanoidDescriptionFromUserId(UserId)
-- add this here
local RemoteEvent = path.to.remote
-- THIS
local Gui = script.Parent
local ViewportCamera = Instance.new("Camera")
ViewportCamera.CFrame = Gui.Adornee.CFrame
ViewportCamera.FieldOfView = 80
Gui.ViewportFrame.CurrentCamera = ViewportCamera
local DetectZone: BasePart = Gui.Adornee.Parent.DetectionZone
local Prompt: ProximityPrompt = Gui.Adornee.Attachment.ProximityPrompt
local debounce = false
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid: Humanoid, HumanoidRootPart = Character:FindFirstChildWhichIsA("Humanoid"), Character:WaitForChild("HumanoidRootPart")
Prompt.Triggered:Connect(function()
if debounce == true then return end
debounce = true
Prompt.Enabled = false
Gui.ViewportFrame:ClearAllChildren()
task.wait(1)
local Parts = workspace:GetPartBoundsInBox(DetectZone.CFrame, DetectZone.Size)
for _, part in Parts do
local PartClone = part:Clone()
PartClone.Parent = Gui.ViewportFrame
RE:FireServer()
-- if you want to add params u can
end
Prompt.Enabled = true
debounce = false
end)
server-side:
local RE = path.to.remote
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Desc = game:GetService("Players"):GetHumanoidDescriptionFromUserId(Player.UserId)
Humanoid:ApplyDescription(Desc)
end)
end)
local Gui = script.Parent
local ViewportCamera = Instance.new("Camera")
ViewportCamera.CFrame = Gui.Adornee.CFrame
ViewportCamera.FieldOfView = 80
Gui.ViewportFrame.CurrentCamera = ViewportCamera
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
local DetectZone: BasePart = Gui.Adornee.Parent.DetectionZone
local Prompt: ProximityPrompt = Gui.Adornee.Attachment.ProximityPrompt
local debounce = false
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid: Humanoid, HumanoidRootPart = Character:WaitForChild("Humanoid"), Character:WaitForChild("HumanoidRootPart")
Prompt.Triggered:Connect(function()
if debounce == true then return end
debounce = true
Prompt.Enabled = false
Gui.ViewportFrame:ClearAllChildren()
task.wait(1)
local Parts = workspace:GetPartBoundsInBox(DetectZone.CFrame, DetectZone.Size)
for _, part in Parts do
local PartClone = part:Clone()
PartClone.Parent = Gui.ViewportFrame
RemoteEvent:FireServer()
end
Prompt.Enabled = true
debounce = false
end)
Server:
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local HumanoidDesc: HumanoidDescription = game.Players:GetHumanoidDescriptionFromUserId(Player.UserId)
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
Humanoid:ApplyDescription(HumanoidDesc)
end)
end)
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local HumanoidDesc = game.Players:GetHumanoidDescriptionFromUserId(Player.UserId)
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
Humanoid:ApplyDescription(HumanoidDesc)
end)
end)
Client:
local Gui = script.Parent
local ViewportCamera = Instance.new("Camera")
ViewportCamera.CFrame = Gui.Adornee.CFrame
ViewportCamera.FieldOfView = 80
Gui.ViewportFrame.CurrentCamera = ViewportCamera
local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local DetectZone: BasePart = Gui.Adornee.Parent.DetectionZone
local Prompt: ProximityPrompt = Gui.Adornee.Attachment.ProximityPrompt
local debounce = false
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid: Humanoid, HumanoidRootPart = Character:WaitForChild("Humanoid"), Character:WaitForChild("HumanoidRootPart")
Prompt.Triggered:Connect(function()
if debounce == true then return end
debounce = true
Prompt.Enabled = false
Gui.ViewportFrame:ClearAllChildren()
task.wait(1)
local Parts = workspace:GetPartBoundsInBox(DetectZone.CFrame, DetectZone.Size)
for _, part in Parts do
local PartClone = part:Clone()
PartClone.Parent = Gui.ViewportFrame
RemoteEvent:FireServer()
end
Prompt.Enabled = true
debounce = false
end)