Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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]

0
instead of deleting the platform try moving it to ServerStorage. You can also try saving the part's Position. LostPast 253 — 5y

3 answers

Log in to vote
0
Answered by
chomboghai 2044 Moderation Voter Community Moderator
5 years ago

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 :)

Ad
Log in to vote
0
Answered by 5 years ago

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.

0
It's just game.Workspace.Platform:Destroy(). climethestair 1663 — 5y
0
And what If I want a cooldown in between the Destroyal and the Cloning. Where do I put wait? maup12345 20 — 5y
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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!

Answer this question