Hello everybody,
I'd like to know if it's possible to reset my scripts write in the Workspace when the Character dies. For example, i change the color and material of a button when i click on it but after the Character dies, it's still changed. My goal is to reset the button to the original one. I tried to search on forum and Web but can't find anything about it.
I'd like to know if it exists a way to reset my scripts (one-by-one? or all at the same time?) Also, the game has many spawns (like a obby).
Thank you in advance for your help.
If you want to reset workspace scripts use this:
use a Server Script
place it in Starter Character Scripts
clone all scripts into lighting
put this code into the server script
script.Parent.Humanoid.Died:Connect(function() --// checks for players death for i,v in pairs(workspace:GetDescendants()) do if v:IsA("Script") then v:Destroy() end end for i,v in pairs(game.Lighting:GetDescendants()) do -- // gets the descendants and checks for scripts if v:IsA("Script") then v:Clone().Parent = workspace --// fixed thanks to ImKidra end end end)