Hello again.
With reference to the question mentioned, how do I do it?
Let's say that I am standing on a block and if that is true, I want it to print "Hi". How could it be done?
Many thanks, RealCMDMinecraft
You should use the Touched signal, like so:
workspace.hiPart.Touched:connect(function() print("hi") end)
If you want to make this relative, use the following:
--Note that this script is a child of the part that says hi. script.Parent.Touched:connect(function() print("hi") end)
I think all of this will work. Note the Touched signal fires even if a different part touches hiPart.
If you want it to fire only when a player touches the block, use Humanoid's touched signal. I don't know how to use that signal, so that's why I used the regular BasePart's touched signal.
print ("Hi") function onTouched(hit) print("Brick Hit") local human = hit.Parent:findFirstChild("Humanoid") if (human ~= nil ) then Brick.Transparency = 0.7 Brick.CanCollide = false wait(4) -- this is how long the block can long Brick.CanCollide = true Brick.Transparency = 0 -- a human has touched this door! print("Human touched block") -- test the human's name against the permission list elseif (checkOkToLetIn(human.Parent.Name)) then print("Human passed") Brick.Transparency = 0.7 Brick.CanCollide = false wait(4) -- this is how long the block can long Brick.CanCollide = true Brick.Transparency = 0 else human.Health = 0 -- delete this line of you want a non-killing block end end end script.Parent.Touched:connect(onTouched)
Make sure to call the block "Brick" or call it however you want, but then replace the "Brick" in all these lines with what you want.