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

Humanoid touches a certain block and it disappears?

I am trying to make a mod for SCP-096 which is breaking down a certain door, but since I am really new with Lua I can't figure out how to make it so when SCP-096 touches the door it will un-collide and the transparency will be set to one.

script.Parent.Touched.Door:connect (function()
 (workspace.SCP096.Torso.BreakBlock
	game.workspace.Door.Transperancy = 1
	workspace.Door.CanCollide = false)
end)

I am also trying to make a clickable regen button that only certain group members can press so the door will regen. I have a different script that completely destroys the door and makes it just gone so a regen button is able to regenerate it. But neither of them break the door, I also don't know which one is more reliable.

script.Parent.Touched.Door:connect (function()
local Door = workspace.Door
Door:Destroy()
Door:Parent = workspace
end)

If you could find out which is more reliable/better for a regen button that would help a lot. Also, I know that the regen script is going to have many bugs here and there, so I am sorry if it causes too much trouble.

game.Players.PlayerAdded:connect(function(Player)
    if Player:GetRankInGroup(3834294) > 1 then

    else

    end
end)

model = script.Parent.Parent




backup = model:clone()
enabled = true

function regenerate()

	model:remove()

	wait(2)
	script.Parent.Fixing.play ()
	game.SoundService.AmbientReverb.Cave
	wait(4.5)
	game.SoundService.AmbienetReverb.NoReverb


	model = backup:clone()
	model.Parent = game.Workspace
	model:makeJoints()


	script.Disabled = true
	wait(120)
	script.Disabled = false
end

script.Parent.MouseButton1Click:connect(function()
	local function findFirstChild(instance, name, recursive)
    for _, child in pairs(instance:GetChildren()) do
        if child.Name == door then
            return child
        elseif recursive then
            return findFirstChild(child, name, true)
        end
    end
	end
	 local found = workspace:FindFirstChild("Door")
if found then 
		if (clicked.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then
		regenerate()
  
end
end)
	if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then
		regenerate()
	end
end

2 answers

script.Parent.Touched:connect (function()

Dont put in the .door

1 comment

0

That wasn't what I was wanting. I am looking for if someone CLICKS the door regen button it'll regen, not if you touch it. Also, what you said is confusing I don't get what you mean, "Don't put in the .door"

Try adding the Button1Down function to your script. Hopefully this works

2 comments

0

In what spot?

0

Beside the ":connect" its confusing on which function u mean. But put it beside the one u want the regeneration to happen

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