I'm making a domino game where if you knock them all over, you can press a gui button to stand all of them back up. The only thing is, I don't know where to start if I were to script this. Can I just move the group through a script? Would this stand them all back up?
How to reset a part with a button?
1 answer
Put a localscript in the button. Put a duplicate of the dominos in ServerStorage. Put this in the script:
(Change the variables to the actual dominos, these are just directories I made up)
local DominosToReset = workspace.Dominos
local DominosInStorage = game.ServerStorage.Dominos
function leftClick()
print("Button Click”)
DominosToReset:Destroy()
DominoReplacers = DominosInStorage:Clone()
DominoReplacers.Parent = workspace
DominosToReset = DominoReplacers
end
script.Parent.MouseButton1Click:Connect(leftClick)
The idea is that the dominos in ServerStorage are cloned to replace the old ones as they are deleted.
This was coded from my head, there may be errors.
Hope this helps you. Merry Christmas! :)
7 comments
You should also set the DominosToReset to the cloned dominoes so you can destroy them after too
Good idea. Editing now
Don't use Lighting as storage. It's not meant for that at all.
Sorry, it’s just a bad habit
Why not put the dominoes in the workspace but they are invisible then whenever you need them make a copy and set their cframe to the dominoes place and make them visible?
That sounds like a hassle to write a script to change all the transparencies during runtime and I believe it wouldn’t improve anything, it might cause a performance downgrade too
That sounds like a hassle to write a script to change all the transparencies during runtime and I believe it wouldn’t improve anything, it might cause a performance downgrade too
This discussion is preserved as it was. New answers, comments, and votes are closed.

9 comments
So it is basically a "regen all dominoes" button?
Yes. I can script it, but I just don't know where to start.
Make a copy of the model and store it in ServerStorage. When you want to reset the model you remove the original model and replace it with the copied one.
At the start I'd make a table with all parts as keys, and the value the starting CFrame when the game starts, when you reset, you can restore those CFrames.
FloweryMonkey why not do what Kate said? Isn't that the same thing as replacing with CFrames but just positioning them at the right spot?
FlowerMonkey that seems unnecessarily tedious when you can just replace it with a clone.
Destroying and cloning a whole new object into the workspace is performance wise much worse, since it has to render out all instances, and render them back in. Otherwise you only have to update the CFrame which is a single thing to do
Eh, I guess that makes sense. But if it’s a simple game, it should be fine
Why not put the dominoes in the workspace but they are invisible then whenever you need them make a copy and set their cframe to the dominoes place and make them visible?