Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local reversesort = false --this will just reverse the keys names
- local location = game.Workspace.Piano.Keys.Keys --Change this to where your piano keys are located
- local positions = {}
- for i,v in pairs(location:GetChildren()) do
- if v then
- table.insert(positions,v.Position.x)
- end
- end
- if reversesort then
- table.sort(positions,function(a,b) return a>b end)
- else
- table.sort(positions)
- end
- for a,b in pairs(positions) do
- for i,v in pairs(location:GetChildren()) do
- if v and v.Position.x == b then
- v.Name = a
- break
- end
- end
- end
Add Comment
Please, Sign In to add comment