Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do you make a transparent block reveal itself when touched?.

Asked by 10 years ago

Please include the code which you are trying to use, so the community will be better-equipped to help you with your problem.

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.

0
Thanks alot Extreme2219 0 — 10y

5 answers

Log in to vote
0
Answered by
Sublimus 992 Moderation Voter
10 years ago

@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)
0
He asked when touched, he never specifically stated whether that should be a person or something else. TheMyrco 375 — 10y
Ad
Log in to vote
1
Answered by
TheMyrco 375 Moderation Voter
10 years ago

This script should be put inside the part in order to work.

script.Parent.Touched:connect(function(p)
    script.Parent.Transparency = 0
end)
Log in to vote
0
Answered by
duckwit 1404 Moderation Voter
10 years ago

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
Log in to vote
0
Answered by 10 years ago
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)
Log in to vote
0
Answered by 5 years ago

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)

Answer this question