I want this script to happen when the humanoid touches a block, simple request.
-- script
game.Workspace.OHHH.Position = Vector3.new(77.6, 2.5, -195.4)
wait(3)
game.Workspace.OHHH.Position = Vector3.new(76.6, 2.5, -193)
wait(3)
I want this script to happen when the humanoid touches a block, simple request.
-- script
game.Workspace.OHHH.Position = Vector3.new(77.6, 2.5, -195.4)
wait(3)
game.Workspace.OHHH.Position = Vector3.new(76.6, 2.5, -193)
wait(3)
local Part = workspace:FindFirstChild("touchobjectname")
Part.Touched:Connect(function(PartThatTouchedThePart)
--//Whatever happens when the part was touched
end)
thx!
Anytime!
so what you want to do is use the "Touched" event. So what you want to do is insert a script inside the block and add this code to it.
script.Parent.Touched:connect(function(part) -- part is the part that touched it.
if game.Players:FindFirstChild(part.Parent.Name) then-- sees if the part that touches it is a player
local plr = part.Parent
--Code goes here.
end
end)
if you need more help feel free to check out this wiki page - https://developer.roblox.com/api-reference/event/BasePart/Touched
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
humanoid can't touch plocks