Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I don't know how to re-add an platform to the same position?

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]

1 comment

0

instead of deleting the platform try moving it to ServerStorage. You can also try saving the part's Position.

3 answers

✓ Accepted answer

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.

2 comments

0

It's just game.Workspace.Platform:Destroy().

0

And what If I want a cooldown in between the Destroyal and the Cloning. Where do I put wait?

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.