Part appears when player touch

So, I’ve been searching and on youtube how to make a part appear when you touch it. I tried scripting it by myself, but failed. Does anyone know how to script it?

script.Parent.Touched:Connect(function()
	script.Parent.Visible = false
	game.Workspace.Part2.Visible = true
end)
1 Like

Visible isn’t a property of parts. You can do

script.Parent.Touched:Connect(function()
	script.Parent.Transparency = 1
	workspace.Part2.Transparency = 0
end)

OMG I got so use with UIs. Sorry

1 Like
script.Parent.Touched:Connect(function()
	game.Workspace.Part2.Transparency = 0
end)
1 Like

Visible is no property of Basepart, ( parts, spheres, cylinders are a class inherited from it).

script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChildWhichIsA("Humanoid") then
	     script.Parent.Transparency = 0
	     game.Workspace.Part2.Transparency = 0
     end
end)

Transparency is what you are looking for.

2 Likes