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
script.Parent.Touched:connect(function(hit) if hit.Parent:findFirstChild("Humanoid") then script.Parent.Transparency = 0 end end)
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)