How would I make it so it does this.
game.ServerStorage.AllTheToolsOnly.Parent = game.Lighting
I don't know what to do e.e
1 | local serverstorage = game.ServerStorage |
2 | local lighting = game.Lighting |
3 |
4 | for i,v in pairs (serverstorage:GetChildren()) do |
5 | if v:IsA( "Tool" ) then |
6 | v.Parent = lighting |
7 | end |
8 | end |
This script gets all the children of ServerStorage and checks if it is a tool. If it is then it will put it in the Lighting.
Use :IsA(...)
to check if something's a subclass of something else.
1 | for i, v in pairs (something:getChildren()) |
2 | if v:IsA( "Tool" ) then |
3 | v.parent = game:GetService( "Lighting" ) |
4 | end |
5 | end |
You would use a for loop
1 | local tools = game:GetService( "ServerStorage" ) [ "TheTools" ] -- Assuming their in a folder |
2 |
3 | for i,v in pairs (tools:GetChildren()) do |
4 | v.Parent = game:GetService( "Lighting" ) |
5 | end |