I want this script to happen when the humanoid touches a block, simple request.
1 | -- script |
2 | game.Workspace.OHHH.Position = Vector 3. new( 77.6 , 2.5 , - 195.4 ) |
3 |
4 | wait( 3 ) |
5 |
6 | game.Workspace.OHHH.Position = Vector 3. new( 76.6 , 2.5 , - 193 ) |
7 | wait( 3 ) |
1 | local Part = workspace:FindFirstChild( "touchobjectname" ) |
2 | Part.Touched:Connect( function (PartThatTouchedThePart) |
3 | --//Whatever happens when the part was touched |
4 | end ) |
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.
1 | script.Parent.Touched:connect( function (part) -- part is the part that touched it. |
2 | if game.Players:FindFirstChild(part.Parent.Name) then -- sees if the part that touches it is a player |
3 | local plr = part.Parent |
4 | --Code goes here. |
5 | end |
6 | end ) |
if you need more help feel free to check out this wiki page - https://developer.roblox.com/api-reference/event/BasePart/Touched