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.
@above that will run when anything touches it, not just a human
1 | script.Parent.Touched:connect( function (hit) |
2 | if hit.Parent:findFirstChild( "Humanoid" ) then |
3 | script.Parent.Transparency = 0 |
4 | end |
5 | end ) |
This script should be put inside the part in order to work.
1 | script.Parent.Touched:connect( function (p) |
2 | script.Parent.Transparency = 0 |
3 | 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.
1 | part = script.Parent --This script goes inside the part |
2 |
3 | function OnTouched() |
4 | part.Transparency = 0 --Set the transparency to 0 |
5 | end |
6 |
7 | part.Touched:connect(OnTouched) --Connect the function above to the "Touched" event |
1 | script.Parent.Touched:conncet( function (player)) |
2 | x = game.Players:GetChildren() |
3 | for i = 1 , #x do |
4 | if x [ i ] .Name = = player then |
5 | script.Parent.Transparency = 0 |
6 | end |
7 | end |
8 | end ) |
Put this is the part you want to turn visible
1 | script.Parent.Touched:Connect( function (hit) |
2 | if hit.Name = = "PutPartNameHere" then |
3 | script.Parent.Transparency = 1 |
4 | end ) |