Roblox Touch Events: Ultimate Guide

This is the ultimate guide to touch events on Roblox. I will teach you everything there is to know about touch events. I will show you how to use the Touched event and TouchEnded Event. I will show you how to check what touched your part and verify if a player touched the part. I will show you how to use a debounce to limit how often your function does something. I will also show you how to disconnect the function from the touched event. Last but not least I will show you the Roblox API, and how I learned everything I know.
API: developer.roblox.com/en-us/ap...

Пікірлер: 269

  • @CyberCreator
    @CyberCreator3 жыл бұрын

    If you have any questions or requests for future videos, let me know!

  • @darrenchong2054

    @darrenchong2054

    3 жыл бұрын

    Yes I do could u make a video that makes a brick with health gets damaged when the npc enemy touches it.

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    @@darrenchong2054 That's really specific for a full video, but if you join my Discord I can help you work out how to do this. discord.gg/YWqUMzw

  • @darrenchong2054

    @darrenchong2054

    3 жыл бұрын

    @@CyberCreator can u help me with a game problem I have?

  • @deputy_Nico

    @deputy_Nico

    3 жыл бұрын

    How would I script it where when a vehicle touches an invisible box it can trigger the lights that I scripted to begin on my Drag Tree.

  • @TGJPyt

    @TGJPyt

    3 жыл бұрын

    Question: How could I make it so if a player touches the part, it gives them a sword, and when they step off the part, it removes the sword from their inventory. Thanks!

  • @gr33gyss8
    @gr33gyss82 жыл бұрын

    Every step beautifully explained. Even when you explain something really well, you then explain it even further so that the audience completely understands. Outstanding. Thank you.

  • @brodter4756
    @brodter47562 жыл бұрын

    Such clear concise and informative videos. Please keep doing these. I can't wait to learn from the rest of these.

  • @aloe2778
    @aloe2778 Жыл бұрын

    This video was super helpful to understand how this works! Thanks a lot! ✨

  • @kirtil5177
    @kirtil51773 жыл бұрын

    Thank you so much for explaining the syntax, that is by far the biggest reason i dont know how to make something work

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    Happy to help!

  • @diamondhero3804
    @diamondhero38044 ай бұрын

    TYSM, NO VIDEO HAS BEEN ABLE TO EXPLAIN IT AS GOOD AS YOU!!! YESSSSS!!!!

  • @waterymonkey
    @waterymonkey3 жыл бұрын

    AY THIS IS THE BEST TUTORIAL SEEN SO MANY THIS IS THE FIRST THAT EXPLAINS WHAT EVERYTHING THING DOES AND HOW TO BUILD IT TYSM

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    Glad I could help! Thanks for watching!

  • @NewWaveEnthusiast
    @NewWaveEnthusiast3 жыл бұрын

    Thanks for this video,the wiki didn't really explain it like it did for Functions. And holy shit,visual representations too? Lifesaver. Thanks so much for explaining the lines of code,and not just telling me "this will do that",I want to know what it does and how it works. Thanks again,you deserve my sub and like :D

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    I'm glad the video helped you out, and I appreciate the sub, like, and comment!

  • @mrgonuts
    @mrgonuts2 ай бұрын

    thanks really clear and well put together

  • @TECHboi99Official
    @TECHboi99Official3 жыл бұрын

    OMG THANK YOU SO MUCH!!! Im a new dev and i was making a game, but had trouble when the death counter went up by multiple numbers when we touched the brick...i added the debounce and now it works...Thanks a lot!! U earned a sub, like and multiple shares

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    Sweet! Good job getting it to work!

  • @harmonictuneyt
    @harmonictuneyt2 жыл бұрын

    I didnt know about the built in disconnect function! now thats really cool

  • @kourr483
    @kourr483 Жыл бұрын

    bro thank you so much i finally understand because of u!!!

  • @EnderGrad
    @EnderGrad2 жыл бұрын

    one of the best tutorials I have seen

  • @Zrarlq
    @Zrarlq11 ай бұрын

    Thank you so much for this video, I have learn lots I hope that you can make more tutorials in the future!

  • @_an_bakan_5580
    @_an_bakan_55808 ай бұрын

    Thank you so much dude! I can now make a working monolith in my Solar System exploration game!

  • @bagelbananaalt5536
    @bagelbananaalt55362 жыл бұрын

    this is what I like about scripting, the possibility are endless and there are so many ways to mess around like when you touch a part, your head gets bigger or smaller

  • @innerboth7074
    @innerboth70743 жыл бұрын

    Thank you for explaining everything step by step 🙏

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    Glad it was helpful!

  • @Reckless_Build
    @Reckless_Build2 жыл бұрын

    Finally someone that can explain something CORRECTLY. EZ SUBCRIBE

  • @adilailma5658
    @adilailma56588 ай бұрын

    OMG THANK YOU SO MUCH

  • @user-fx1ky1uw4z
    @user-fx1ky1uw4z4 ай бұрын

    EXCELLENT TUTORIAL... I see so many young people rushing through tutorials and making errors mid video... this is perfect. If you're not a teacher , you should be because you're a natural. Very clear and well explained, also.

  • @user-fx1ky1uw4z

    @user-fx1ky1uw4z

    3 ай бұрын

    @TheDogCaused911 the best advice i could give you without seeing your script would be to check the syntax. Code is case sensative and must be precise. After that use prints to test points of your code instead of actions if you have acrid that are not triggering. Part.Touched:connect(function() print ("Part Touched") end)

  • @kaniac_
    @kaniac_2 жыл бұрын

    Thanks so much dude helped alot

  • @colintjuhh
    @colintjuhh2 жыл бұрын

    This is so well understandable

  • @NFTAMetro
    @NFTAMetro3 жыл бұрын

    this is helping me, how you're explaining what everything does. thank you :thumbs_up: this was on my b-day too

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    I'm glad I could help! Happy belated birthday, and don't forget to subscribe so you don't miss out on future videos!

  • @nathanolivera6651
    @nathanolivera66513 жыл бұрын

    I watched you last month when you had 100 subs and now you have 2k subs congratulations

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    Thanks for the support!

  • @Rafwellz
    @Rafwellz2 жыл бұрын

    thank you!!!! this was very helpfull :)

  • @CyberCreator

    @CyberCreator

    2 жыл бұрын

    Glad it was helpful!

  • @xswords5086
    @xswords5086 Жыл бұрын

    this is soo helpful thank you still good in 2022

  • @huntytoohill8529
    @huntytoohill85293 жыл бұрын

    thanks man great tutorial!

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    Glad you liked it!

  • @Sharkpop0
    @Sharkpop03 жыл бұрын

    this was made on my birthday no wonder why this is so cool B)

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    Happy late birthday! lol

  • @catchphrasechristian952
    @catchphrasechristian952 Жыл бұрын

    Thank you so much.

  • @slaplily
    @slaplily2 жыл бұрын

    Helpful vid! But I want to make a game where when you stand on a brick a dialog from an npc starts and you can ask questions by clicking on buttons, how would you do that?

  • @fayking
    @fayking3 жыл бұрын

    0:31 beacon boi : **I AM SPEEEEEDD**

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    lol

  • @pablobossfightcreator9654
    @pablobossfightcreator96542 жыл бұрын

    Thank you very much!

  • @relaxingambience8855
    @relaxingambience88553 жыл бұрын

    Explained very well high quality content, I definitely subscribed because I want to say I was here before 100 subscribers, when you have 100,000.

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    Thanks! I'll see how quickly I can make you right!

  • @chanchowaton
    @chanchowaton3 жыл бұрын

    best tutorial so far

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    Thanks for watching!

  • @JimmyButBetter
    @JimmyButBetter Жыл бұрын

    Ive been trying figure out how to detect if otherpart is a humanoid, hopefully this video helps!

  • @axelysm3463
    @axelysm34632 жыл бұрын

    Im very laggy on roblox studio, Fast or not the F5(run) is always laggy so i need a good teacher, anyways thank you for making this video

  • @vdreeh8601
    @vdreeh86012 жыл бұрын

    Great video

  • @JoonYorigami
    @JoonYorigami2 жыл бұрын

    Thank you, yo! I made a small script without copying an entire script :D

  • @Gorrilarr
    @Gorrilarr4 ай бұрын

    thank you so much

  • @idkhahahaha
    @idkhahahaha2 жыл бұрын

    you are a saint

  • @CyberCreator

    @CyberCreator

    2 жыл бұрын

    Thanks for watching!

  • @buddybuythis3889
    @buddybuythis38899 ай бұрын

    How would you script playing a sound when a player touches another player?

  • @lisadoesstuff9368
    @lisadoesstuff93682 жыл бұрын

    Hi Cyber I have a tutorial idea for you! You have a bow and there's a target and when you shoot at the target a block appears

  • @fnonn
    @fnonn3 жыл бұрын

    thank you

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    Thanks for watching!

  • @futurismepic8537
    @futurismepic85372 жыл бұрын

    touch event could be used in anywhere its insane

  • @tihc1
    @tihc12 жыл бұрын

    Why do you use FindFirsrChildWhichIsA and not FindFirstChild? I did some research and the one you used is to find somethings class. Does that mean your explanation is incorrect?

  • @ns33333
    @ns33333 Жыл бұрын

    Hello, I was trying to find out how to do this, but with changing the material instead of color.. I tried changing the words color here to material, but that did not work. Could you please make a tutorial?!

  • @itzdynamic9356
    @itzdynamic93563 жыл бұрын

    Hey I'm trying to make like a riddles script but I want it to be that you have to go to the first location to activate then go to the second riddle and the third and so on do you know how to pls I need help...

  • @JimmyButBetter
    @JimmyButBetter Жыл бұрын

    Found a bug in a script that plays a sound on client every time you touch but it was spamming the sounds like 3 of them if i touched the part, Thanks!

  • @joelacquah2204
    @joelacquah22042 жыл бұрын

    9:45 why isn't the first child bodycolors? (I just started to learned script a day ago)

  • @nishattasnim3198
    @nishattasnim31982 жыл бұрын

    sir can you make a tutorial of how to make dialogue triggered by touch of a part

  • @yohimaster8359
    @yohimaster83592 жыл бұрын

    Hi i really want a collecting sytem if i step on a part its open a gui and every time i reach 10 coin = 1 rebirth it appear in the gui which can i collect can you show me how to do that its important for me :(

  • @Anastasiatoons
    @Anastasiatoons2 жыл бұрын

    @CyberCreator I am having trouble with local script toch events, I already have a script that allows me to have 2d game controlls, the only problem is that I can't bring the local script playing when I touch a certain part in my game, how to fix it???

  • @arnegraphics3380
    @arnegraphics33802 жыл бұрын

    would this work if the part is set to non-collide?

  • @AppzyCat
    @AppzyCat2 жыл бұрын

    tysm

  • @joelacquah2204
    @joelacquah22042 жыл бұрын

    also if you can just type humanoid why do we use findfirstchild and if we are using findfirstchild why do we need to confirm it is a humanoid that what it's supposed to do?

  • @GeodyEnt
    @GeodyEnt2 жыл бұрын

    Does this work if I want to make the game detect when I touch a specific part in *a group* ? Ex: If I made a car model, grouped all the parts together, would I be able to make it so that when you only touch the window, you die?)

  • @Valorantclips47
    @Valorantclips47 Жыл бұрын

    What do i put instead of “humanoid” if I’m trying to do a specific part instead

  • @heehee6514
    @heehee65143 жыл бұрын

    How would you make it if two players touched? Because i would like to make a script if one player is bigger then the other and when they touch it would kill the smaller player, i just dont know if there is a different code for players.

  • @sparklyspartan1833
    @sparklyspartan18333 жыл бұрын

    Hello CyberCreator I have a question, if I wanted to change something about the part that was actually hit with a touched event, or do something only if that part has a specific property (like material), how could I access that part? Oh and also the reason I can’t just put a script in the part and use script.parent is that I’m using a loop to connect the event to multiple parts as opposed to putting scripts in every single part

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    This is a really good question. The solution is to wrap the function that you are connected to with another function. At the time of looping through and connecting a function to the part, you have access to the part. This means you can just provide the part itself as a parameter to the function. I have an example below. Please keep in mind that the model could be wherever in this case. Let me know if you have questions local model = script.Parent local function doSomething(brick) print(brick.Name .. " was hit") end for _, part in ipairs(model:GetChildren()) do if part:IsA("Part") then part.Touched:Connect(function() doSomething(part) end) end end

  • @sparklyspartan1833

    @sparklyspartan1833

    3 жыл бұрын

    @@CyberCreator wow thanks, I think I get it, I need access to both the part and the other part, but I can just pass them both into the inner function right?

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    @@sparklyspartan1833 Yep that is correct

  • @estelino9019
    @estelino90192 жыл бұрын

    But how to make something like: Touched event fires when player touched a part. But if other player will touch it in exact same time(not just break script after first player) nothing will happen.

  • @Aaxled
    @Aaxled3 жыл бұрын

    hey please respond me, so how do i make an object animation like a car play when i touch a block please i need help

  • @funnycreak6232
    @funnycreak62322 жыл бұрын

    how do i make it so that, when the player touches the part, the body part that has touched the part gets deleted? i want to make like a eradication weapon in my game.

  • @espero_dev
    @espero_dev2 жыл бұрын

    How do I make it pop up a perches on screen but the perches is invisible

  • @lightninggames6299
    @lightninggames6299 Жыл бұрын

    for some reason the touched even is broken for me when ever i touch the part it just doesn't do anything and i tried putting a print and still nothing

  • @kitteryt7252
    @kitteryt72523 жыл бұрын

    Yo!! Nice Vid, but may I get some help? I need it where if someone touches a brick it triggers a local script. ( I am trying to make it where if you touch a brick it triggers this local script which makes it if you press a key it will animate) Please help, if you can I need it ASAP for my game!

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    Join the discord and we can help you out! discord.gg/X3zdqHy

  • @Tommyknocker.
    @Tommyknocker.2 жыл бұрын

    Hello, could I make body velocity event? I really need it for helicopters/jets "scripted scene'

  • @charleshurst7829
    @charleshurst78292 жыл бұрын

    excuse me CyberCreator, would you know how to make it so instead of the humanoid making everything react, how do i make it when an object (for instance, im making a soccer game and im looking for a touch event related to my goals and the soccer ball) touches another object and it reacts? im trying to make it so when my soccer ball touches the back of the net it reacts by saying goal. thankyou

  • @effort9817

    @effort9817

    9 ай бұрын

    uhh i think you just replace humanoid with the name of your hit box i think

  • @fanatic5687
    @fanatic56872 жыл бұрын

    how would you make it so it can trigger a humanoid/ dummy?

  • @iceplaysroblox713
    @iceplaysroblox7132 жыл бұрын

    i ahve a problem on anther thing i rebirth can 30k cash then when i do anther event to open a egg the value gets lost bc it is on clint of the rebirth and idk how to do it in server cus its gui

  • @AerialV
    @AerialV3 жыл бұрын

    only 116 subs, clout the man up 😪

  • @Ion115
    @Ion1152 жыл бұрын

    How to make a script, when a part is touched, then an new part appears in workspace? But, it needed to be touched with an exact object to run the script

  • @turnupbri
    @turnupbri2 жыл бұрын

    Is there a way to make the script fire when it comes in contact with another part?

  • @robb9895
    @robb98952 жыл бұрын

    how do i make a part do something if it touches a terrain material like sand?

  • @joephis
    @joephis3 жыл бұрын

    sorry for another comment lol, but how do you find the player or character (whichever is easier) of a player that pressed a text button?

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    If you are using a LocalScript, you can just type game.Players.LocalPlayer. If you are using a Script, you would need to work your way up to the Player. So if the Structure is Player->PlayerGui->ScreenGui->TextButton->Script You could get the player with script.Parent.Parent.Parent.Parent because the Player is the 4th Parent of the script.

  • @k1ndaconfused4
    @k1ndaconfused42 жыл бұрын

    how would i detect a cloned part being touched when there are multiple coned parts?

  • @TheMythWar
    @TheMythWar3 жыл бұрын

    I'm brazilian, Hi. Obrigado pela explicação sobre funções de toque, foi muito esclarecedor para mim que estou começando. Como faço para verificar enquanto algum jogador tocar na peça leva dano, mas sem usar RunService.Stepped:Connect() para não sobrecarregar o Servidor?

  • @deadbrav

    @deadbrav

    Жыл бұрын

    He doesn't know brazillian, wait You don't know how to read my reply too

  • @Astro.Editss
    @Astro.Editss2 жыл бұрын

    I was looking for when you touch a part it does a animation

  • @VLKYRI
    @VLKYRI2 жыл бұрын

    How can I do a touch function but it only goes off it the part has a specific name?

  • @ikplayer3
    @ikplayer32 жыл бұрын

    how do you detect if another part is touching the part

  • @kirillstricke1387
    @kirillstricke13872 жыл бұрын

    please help how to make it so that if you touched the block then it will change the sky

  • @tem_thetomato8884
    @tem_thetomato88842 жыл бұрын

    Maybe someone has asked this already but does anyone know how to make a part fire an event when another part touch’s it like it players a sound or something I have not watched the full video yet maybe he already says how :)

  • @HIHIHELLOHI11872
    @HIHIHELLOHI11872 Жыл бұрын

    ok wait but is there a way to make it so when a player touches a player they both die?

  • @sadnipple9000
    @sadnipple90002 жыл бұрын

    I am trying to make a pet script where it eats and the targeted food dissapear. I hope this helps me!

  • @kleenexdrinker
    @kleenexdrinker3 жыл бұрын

    i didn't watch the whole thing but, If this doesn't have a feature that can detect if your left arm or right arm touches a player after clicking e or r or something could you make a tutorial on it?

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    That sounds pretty specific. We can help you work up a solution if you join the discord discord.gg/X3zdqHy

  • @deputy_Nico
    @deputy_Nico3 жыл бұрын

    How would I script it where when a vehicle touches an invisible box it can trigger the lights that I scripted to begin on my Drag Tree.

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    Join the discord and we can help discord.gg/vrHQCMM

  • @juliendewallers6374
    @juliendewallers63743 жыл бұрын

    hi, i've a question, could u make a video that makes a collectable brick with ontch script ?, because i wanna create a quest for collect items but i find only with "Clickdetector" ! :'( thx by advance,

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    I plan on making an inventory video which relates to that. if you already have a system that works with ClickDetectors, it should be fairly easy making it work with the Touched event. Join the discord if you're trying to convert it: discord.gg/vrHQCMM

  • @milchbanane9087
    @milchbanane9087 Жыл бұрын

    Well I had an issue and didn't know how to fix it, so I copied the exact script you used and it still spits out the same error. It says "FindFirstChildWichIsA is not a valid member of Workspace "Workspace"" And if I walk over it, it displays one of my body parts (the one that touched it) instead of Workspace.

  • @opjes1wjwj

    @opjes1wjwj

    10 ай бұрын

    dont know if you fixed it but make sure you put a ":" instead of a "."

  • @rebekahmullins5703
    @rebekahmullins57032 жыл бұрын

    How you make it move your player?

  • @Doovlie
    @Doovlie2 жыл бұрын

    How can I make it on touch it spawns an NPC from replicated storage?

  • @peterbakoss8803
    @peterbakoss88033 жыл бұрын

    Will you remember me when you become famous? :)

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    💯

  • @WinPeck
    @WinPeck2 жыл бұрын

    How do i make the player run faster when the player touch’s a part I been trying for days now

  • @JUMPYYELLOWfr
    @JUMPYYELLOWfr Жыл бұрын

    how would i make a notifacation pop up

  • @15huynh
    @15huynh3 жыл бұрын

    I wanted one of the part touch on an object and exploded can you do that? I would be appreciate about it. 😊

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    script.Parent.Touched:Connect(function(hit) local explosion = Instance.new("Explosion") explosion.Position = hit.Position explosion.Parent = hit end) Put this in a script in a part

  • @lonelylad9818
    @lonelylad98186 ай бұрын

    How do I do an event for when two players touch eachother?

  • @KingShepskiy
    @KingShepskiy Жыл бұрын

    You are very good at explaining but you also over explain a little bit 😂

  • @user-mr7eh7tq4k
    @user-mr7eh7tq4k2 жыл бұрын

    How do you make an item that transforms when touched?

  • @gamingclub4750
    @gamingclub4750Ай бұрын

    how do i make a touched function to the power cuz its hard

  • @mafiali2523
    @mafiali25233 жыл бұрын

    just wondering, is there a way where you can touch a part and a gui pops up to teleport somewhere

  • @CyberCreator

    @CyberCreator

    3 жыл бұрын

    Yes! Use the code shown in the video to make to check if a player touched a part, and then if so make the Gui visible by toggling the "Enabled" property of the ScreenGui from false to true. You will want to use a debounce if you are copying the ScreenGui to the player's PlayerGui

  • @printer12345
    @printer12345 Жыл бұрын

    what the hell is other part isnt FindFirstChildren enough? why roblox added FindFirstChildrenWhichIsA when FindFirstChildren exist

  • @kappaster9000
    @kappaster90002 жыл бұрын

    understandable

  • @CyberCreator

    @CyberCreator

    2 жыл бұрын

    Thanks for watching!