Hello,
I am making a script or a feature as a test where when I press on a green button a platform dissapears. And then I want it to appear back on the exact same place and the exact same size. Just like a death run.
But I can't manage on how to re-add the platform. This is the code I use to let the platform disappear.
game.Workspace.RemoteEvent.OnServerEvent:Connect(function() game.Workspace.Platform:Destroy(game.Workspace.Platform) end)
Can anyone explain to me on how re-add the platform to the same position? I will send a screenshot down below on how the structure looks like, Thanks!!
[https://gyazo.com/a3622ee777dc1f3e63a211acc7646a49]
Instead of completely destroying it and making a whole new part, why don't you just make it look like it disappeared?
Simply set the part's Transparency
to 1 so it appears invisible, then set the CanCollide
option to false so players can no longer walk on it.
With those two options together, the part is basically non-existent. When you want the part to come back, just reset Transparency
to 0, and CanCollide
to true.
Hope this helps :)
You could do:
game.Workspace.RemoteEvent.OnServerEvent:Connect(function() local clone = game.Workspace.Platform:Clone() game.Workspace.Platform:Destroy(game.Workspace.Platform) clone.Parent = game.Workspace end)
It will clone the platform, then Destroy the old one, and parent the clone to Workspace. Or you can create new part via Instance.new, and set it's size, position to the old one's size and position.
I put wait(5) to get it to work!
game.Workspace.RemoteEvent.OnServerEvent:Connect(function() local clone = game.Workspace.Platform:Clone() game.Workspace.Platform:Destroy()wait(5) clone.Parent = game.Workspace end)
Thank you all for helping me out!