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
If you have any questions or requests for future videos, let me know!
@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
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
3 жыл бұрын
@@CyberCreator can u help me with a game problem I have?
@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
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!
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.
Such clear concise and informative videos. Please keep doing these. I can't wait to learn from the rest of these.
This video was super helpful to understand how this works! Thanks a lot! ✨
Thank you so much for explaining the syntax, that is by far the biggest reason i dont know how to make something work
@CyberCreator
3 жыл бұрын
Happy to help!
TYSM, NO VIDEO HAS BEEN ABLE TO EXPLAIN IT AS GOOD AS YOU!!! YESSSSS!!!!
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
3 жыл бұрын
Glad I could help! Thanks for watching!
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
3 жыл бұрын
I'm glad the video helped you out, and I appreciate the sub, like, and comment!
thanks really clear and well put together
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
3 жыл бұрын
Sweet! Good job getting it to work!
I didnt know about the built in disconnect function! now thats really cool
bro thank you so much i finally understand because of u!!!
one of the best tutorials I have seen
Thank you so much for this video, I have learn lots I hope that you can make more tutorials in the future!
Thank you so much dude! I can now make a working monolith in my Solar System exploration game!
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
Thank you for explaining everything step by step 🙏
@CyberCreator
3 жыл бұрын
Glad it was helpful!
Finally someone that can explain something CORRECTLY. EZ SUBCRIBE
OMG THANK YOU SO MUCH
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
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)
Thanks so much dude helped alot
This is so well understandable
this is helping me, how you're explaining what everything does. thank you :thumbs_up: this was on my b-day too
@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!
I watched you last month when you had 100 subs and now you have 2k subs congratulations
@CyberCreator
3 жыл бұрын
Thanks for the support!
thank you!!!! this was very helpfull :)
@CyberCreator
2 жыл бұрын
Glad it was helpful!
this is soo helpful thank you still good in 2022
thanks man great tutorial!
@CyberCreator
3 жыл бұрын
Glad you liked it!
this was made on my birthday no wonder why this is so cool B)
@CyberCreator
3 жыл бұрын
Happy late birthday! lol
Thank you so much.
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?
0:31 beacon boi : **I AM SPEEEEEDD**
@CyberCreator
3 жыл бұрын
lol
Thank you very much!
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
3 жыл бұрын
Thanks! I'll see how quickly I can make you right!
best tutorial so far
@CyberCreator
3 жыл бұрын
Thanks for watching!
Ive been trying figure out how to detect if otherpart is a humanoid, hopefully this video helps!
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
Great video
Thank you, yo! I made a small script without copying an entire script :D
thank you so much
you are a saint
@CyberCreator
2 жыл бұрын
Thanks for watching!
How would you script playing a sound when a player touches another player?
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
thank you
@CyberCreator
3 жыл бұрын
Thanks for watching!
touch event could be used in anywhere its insane
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?
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?!
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...
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!
9:45 why isn't the first child bodycolors? (I just started to learned script a day ago)
sir can you make a tutorial of how to make dialogue triggered by touch of a part
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 :(
@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???
would this work if the part is set to non-collide?
tysm
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?
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?)
What do i put instead of “humanoid” if I’m trying to do a specific part instead
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.
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
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
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
3 жыл бұрын
@@sparklyspartan1833 Yep that is correct
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.
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
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.
How do I make it pop up a perches on screen but the perches is invisible
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
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
3 жыл бұрын
Join the discord and we can help you out! discord.gg/X3zdqHy
Hello, could I make body velocity event? I really need it for helicopters/jets "scripted scene'
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
9 ай бұрын
uhh i think you just replace humanoid with the name of your hit box i think
how would you make it so it can trigger a humanoid/ dummy?
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
only 116 subs, clout the man up 😪
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
Is there a way to make the script fire when it comes in contact with another part?
how do i make a part do something if it touches a terrain material like sand?
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
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.
how would i detect a cloned part being touched when there are multiple coned parts?
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
Жыл бұрын
He doesn't know brazillian, wait You don't know how to read my reply too
I was looking for when you touch a part it does a animation
How can I do a touch function but it only goes off it the part has a specific name?
how do you detect if another part is touching the part
please help how to make it so that if you touched the block then it will change the sky
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 :)
ok wait but is there a way to make it so when a player touches a player they both die?
I am trying to make a pet script where it eats and the targeted food dissapear. I hope this helps me!
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
3 жыл бұрын
That sounds pretty specific. We can help you work up a solution if you join the discord discord.gg/X3zdqHy
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
3 жыл бұрын
Join the discord and we can help discord.gg/vrHQCMM
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
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
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
10 ай бұрын
dont know if you fixed it but make sure you put a ":" instead of a "."
How you make it move your player?
How can I make it on touch it spawns an NPC from replicated storage?
Will you remember me when you become famous? :)
@CyberCreator
3 жыл бұрын
💯
How do i make the player run faster when the player touch’s a part I been trying for days now
how would i make a notifacation pop up
I wanted one of the part touch on an object and exploded can you do that? I would be appreciate about it. 😊
@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
How do I do an event for when two players touch eachother?
You are very good at explaining but you also over explain a little bit 😂
How do you make an item that transforms when touched?
how do i make a touched function to the power cuz its hard
just wondering, is there a way where you can touch a part and a gui pops up to teleport somewhere
@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
what the hell is other part isnt FindFirstChildren enough? why roblox added FindFirstChildrenWhichIsA when FindFirstChildren exist
understandable
@CyberCreator
2 жыл бұрын
Thanks for watching!