Hi, i have been looking for hours how to do it but couldn't find anything. Does anyone know how to unanchor a model from a script AFTER a specific time? Lets say if map (Model) named (Map1) spawns in, then after 5 seconds the whole map will unanchor.
Map changing script
01 | while true do |
02 | game.Lighting.Map 1 :clone().Parent = game.Workspace |
03 | wait( 10 ) --Change this to the time between each map. Goes in seconds not minutes or hours. You can do min. or hrs. if u know how much seconds are on there. |
04 | local msg = Instance.new( "Message" ) |
05 | msg.Parent = game.Workspace |
06 | msg.Text = ( "Loading next map" ) --Change this to the title of the map. |
07 | wait( 4 ) |
08 | msg:remove() |
09 | game.Workspace.Map 1 :remove() |
10 | wait( 2 ) |
11 |
12 | game.Lighting.Map 2 :clone().Parent = game.Workspace |
13 | wait( 10 ) --Change this to the time between each map. |
14 | msg.Parent = game.Workspace |
15 | msg.Text = ( "Loading next map" ) --Change this to the title of the map. |
You can use GetDescendants() instead of GetChildren(). The difference is that GetDescendants() gets ALL of the contents (including other models inside the model) while GetChildren() only gets the model's contents you assigned to (only gets children to one model).
1 | wait( 5 ) |
2 | local Descendants = MapModel:GetDescendants() |
3 |
4 | for i = 1 , #Descendants do |
5 | local child = Descendants [ i ] |
6 | if child:IsA( "BasePart" ) then |
7 | child.Anchored = false |
8 | end |
9 | emd |
Well you could use a for loop (as far as i know)
Like this (assuming Map1 is already in workspace):
1 | wait( 5 ) |
2 | for i,v in pairs (workspace.Map 1 :GetChildren()) do |
3 | if v:IsA( "BasePart" ) then -- to exclude decals and whatnot |
4 | v.Anchored = false |
5 | end |
6 | end |