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

How do I make a part undeletable?(UNANSWERED)

Asked by 10 years ago

Well, I'm trying to make an undeletable block, but the script only works once. I need help finding out what is causing this and why... Here's my script.

local x = script.Part
local clone = x:Clone()

script.ChildRemoved:connect(
function(Object)
    if Object == x then
        clone.Parent = Workspace
        x = clone
        clone = x:Clone()
        print("PROTECTED")
    end
end
)
0
Try again? HexC3D 830 — 10y
0
Well, what do you mean by undeletable? Like a player with a delete tool can't come and delete it? If so, change the Locked property to true. If it's something like it falling off the map, your script looks fine. The only thing I would suggest is within your function, you should then clone x. Shawnyg 4330 — 10y

1 answer

Log in to vote
0
Answered by 5 years ago

Well, I'm not sure but it should be basic. Make the block transperency of 1 and can collide on false.

local thing = game.Workspace.Part
thing.Transparency = 0 -- If you want to put wait you can --
thing.CanCollide = true 
wait(5)
thing.Transparency = 1
thing.CanCollide = false

Code with wait

local thing = game.Workspace.Part
wait(5)
thing.Transparency = 0
thing.CanCollide = true 
wait(5)
thing.Transparency = 1
thing.CanCollide = false

Or you could use a 'Function' (If you want loop)

function appear(item0,item1)
    local thing = game.Workspace.Part
    thing.Transparency = item0
    thing.CanCollide = item1
end

appear(0,true)
wait(5)
appear(1,false)

Your welcome

Ad

Answer this question