So I want to make a clone of my map, which is put in a viewport. For this, I need to clone lighting and terrain. Is there a simple way to do this?
This is a bad idea. May cause FPS to drop as low as 2 or 3 with big maps
I recommend you do this client side, this wont really lag the player if it is done client side, as you aren’t really loading the map, you’re putting this in a VPF. I actually did this, and cloned the map to make a mini map system. , you unfortunately can’t clone lighting or terrain through a script. I highly recommend having a fake camera follow the player, and it is a little higher than the player’s character, so it basically displays them walking, and the View Port Frame does the rest, this should replicate lighting, and terrain, I believe this is how Jailbreak and some other games do it.
Lighting is a service, not a reusable object. Services cannot be cloned. Lighting is also not applicable to a ViewportFrame. ViewportFrames work with an anchored lighting setting which can be modified with the Ambient, LightColor and LightDirection properties.
Terrain can’t be cloned either. The rule of thumb is that if you can’t use the Clone method on it, there is no way to do it. If you can’t use the very base method responsible for cloning, there is no “simple way”. You’ll have to find something different or rework your design.
How would I make camera go on top of the player? For now, all I did was use the current camera.
say camera.CFrame = CFrame.new(plr.Character.UpperTorso.Position + Vector3.New(0,30,0),plr.Character.UpperTorso.Position)