game.Workspace.key1.ClickDetector.MouseClick:Connect(function() game.Workspace.key1.Parent = game.ReplicatedStorage end)
game.Workspace.key2.ClickDetector.MouseClick:Connect(function() game.Workspace.key2.Parent = game.ReplicatedStorage end)
game.Workspace.key3.ClickDetector.MouseClick:Connect(function() game.Workspace.key3.Parent = game.ReplicatedStorage end)
game.Workspace.key4.ClickDetector.MouseClick:Connect(function() game.Workspace.key4.Parent = game.ReplicatedStorage end)
game.Workspace.key5.ClickDetector.MouseClick:Connect(function() game.Workspace.key5.Parent = game.ReplicatedStorage end)

2 comments
Thank you Zethuslmam. i wanted to ask, what does "in pairs" do?
I'm pretty sure in pairs just returns 2 values from every iteration of that loop, i being the index (for example if the loop was iterating through workspace.key1, i would be 1 since that's the first value in the table) and the actual value from that table (if the index was 1 then that means we are at the first position of the table so the variable "Key" would be workspace.key1)