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

How do I make a part undeletable?(UNANSWERED)

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
)

2 comments

0

Try again?

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.

1 answer

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

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