How to clone a map so that it slowly fades in

Hello, everyone! I’ve been trying to make a script that will clone a map (with parts on it) and make it become gradually transparent instead of cloning it so that map randomly appears. I only want this map to be visible for a local player that is in a Region3.

I have an idea of a way to do this:
Detect if a player is in a region3 in a normal script and then fire a remote event for the local player so that only they see the map.
The main problem that I’ve run into is making the map and all parts on it appear slowly instead of being cloned rapidly. I’m only aware of how to make one part appear slowly. I’ve had some ideas, and none of them were efficient enough.

Thanks to all that help me! <3

1 Like

Have you tried using TweenService to smoothly tween the transparency property of multiple parts at a time? Depending on how many parts there are, this may be a good option. You’d have to loop through each part that is a descendant of the map and create a tween, which could still be very performance hungry depending on the quantity of tweens created.

1 Like

I’m sorry. I still don’t understand how I could play different tweens at the same time. Wouldn’t I have to use coroutine?

1 Like

No, you shouldn’t need to. Forgive me if this code is wrong as I am not at my computer, but you could try something like this:

local TweenService = game:GetService("TweenService")
local model = workspace:FindFirstChild(“yourmodel”)

function tweenPart(part) 
    local newTween = TweenService:Create(part, TweenInfo.new(1), {Transparency = 0} )
    newTween:Play()
end

for index, object in pairs(model:GetDescendants()) do
    if object:IsA(“BasePart”) then
        tweenPart(object)
    end
end

This code assumes that the parts are already transparent before tweening

1 Like

Thanks so much for taking the time to make this! I’m not sure if it will work, as I don’t have access to studio at the moment either, but from what I can see, it looks like it will work.

Once again, thanks so much!

2 Likes

Most games tend to use a GUI to fade to black or some other covering of the screen whilst the cloning happens, and then fade that away to reveal. This is quite simple as you don’t have to worry much.

If you do choose to go with tweening the transparency of parts, I strongly advise you use LocalTransparencyModifier instead of Transparency. If you use Transparency you will lose the original transparency of things like windows, fully transparent parts, and anything other than opaque parts.

Setting LocalTransparencyModifier to 1 makes a part invisible, and setting it to 0 simply returns to the setting of Transparency.

To add onto the code in the other person’s reply, you’ll need to set LocalTransparencyModifier to 1 for all of the parts before you initiate their tween back to 0.

2 Likes

This seems interesting. I was thinking of putting a GUI to make this easier but thought that I still might be able to make all the parts fade in.
I’ve never heard of TransparencyModifier. It looks interesting. I’ll do some research and see how I can incorporate it in my game.
Thanks for the help!

1 Like

No problem. Check out the following pages for more info:

The fact it’s available on decals too means any parts which have images can also be faded in without affecting their final opacity.

I did just realise you may also run into trouble with any SurfaceGuis, BillboardGuis or Textures. If the map is fairly simple and doesn’t contain these then hopefully you won’t have any issues.

A transition GUI is the easiest but it’s also very common - making parts fade in will certainly make the transition stand out and appear interesting to the player. Good luck

1 Like

While this solution will work, consider that transparent parts have a significantly higher performance impact than regular parts. If you’re loading in an entire map this way, it’s probably not going to perform very well if it has a lot of parts.

2 Likes