I need help with this im making a fun game for robloxians like a magical world based on the anime Fairy tail : Rising Magic and im not sure how to Make a see-through block reveal itself by being touched.
✓ ANSWER ACCEPTED
How do you make a transparent block reveal itself when touched?.
5 answers
✓ Accepted answer
@above that will run when anything touches it, not just a human
script.Parent.Touched:connect(function(hit)
if hit.Parent:findFirstChild("Humanoid") then
script.Parent.Transparency = 0
end
end)
1 comment
0
He asked when touched, he never specifically stated whether that should be a person or something else.
This script should be put inside the part in order to work.
script.Parent.Touched:connect(function(p)
script.Parent.Transparency = 0
end)
Roblox features event-based programming, so what you need to do here is 'listen' for the 'Touched' event - this is an event for all Part Instances and it 'fires' (runs) when something touches it.
part = script.Parent --This script goes inside the part
function OnTouched()
part.Transparency = 0 --Set the transparency to 0
end
part.Touched:connect(OnTouched) --Connect the function above to the "Touched" event
script.Parent.Touched:conncet(function(player))
x = game.Players:GetChildren()
for i = 1, #x do
if x[i].Name == player then
script.Parent.Transparency = 0
end
end
end)
Put this is the part you want to turn visible
script.Parent.Touched:Connect(function(hit)
if hit.Name == "PutPartNameHere" then
script.Parent.Transparency = 1
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thanks alot