Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can i execute this script if a humanoid touchs a block?

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)

1 comment

0

humanoid can't touch plocks

2 answers

✓ Accepted answer
local Part = workspace:FindFirstChild("touchobjectname")
Part.Touched:Connect(function(PartThatTouchedThePart)
   --//Whatever happens when the part was touched
end)

2 comments

0

thx!

0

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.