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

how do i make it so when someone touches a part i run some coding?

pls help me with this am confuse

1 comment

0

This is not a request site.

1 answer

✓ Accepted answer

Add a script into the part. Type this code:

script.Parent.Touched:Connect:function(hit) -- When the brick is touched
local h = hit.Parent:FindFirstChildWhichIsA("Humanoid") -- Detecting if the model that touched it contains a humanoid to prevent lag
if h then -- If the model contains a humanoid
  --- Type your code here. Remember, 'hit' is the part that touched the brick, and 'h' is the player's humanoid.
end) -- Ends the function.

This discussion is preserved as it was. New answers, comments, and votes are closed.