How to Create and Destroy Models by Clicking Parts in Roblox Studio

Поділитися
Вставка
  • Опубліковано 23 лют 2021
  • In this video, I will show you how to create and destroy models in Roblox Studio when you click a button! It's longer than usual, but to get everything to work, you need to watch the entire video. I recommend you watch this video in 2x speed.
    How to make a model: • How to Make a Model in...
  • Ігри

КОМЕНТАРІ • 78

  • @omega72519
    @omega72519 2 роки тому +12

    For those who wanna know how to do this with the touched script, just take this script for example
    script.Parent.MouseClick:Connect(function()
    script.Parent:Destroy()
    end)
    And replace "MouseClick" with "Touched", that's it, and of course if you want you can add the other stuff thats seen in the video.
    After you replace "MouseClick"
    you should end up with an example of:
    script.Parent.Touched:Connect(function()
    script.Parent:Destroy()
    end)
    It does work, and yes, you can use this for sound triggers, I am making a game that requires 1 time sound triggering and this is the best way for that

    • @omega72519
      @omega72519 2 роки тому

      To @Toytl King
      If you think this is helpful, go ahead and pin it, it does work

    • @IVsHorror
      @IVsHorror 2 роки тому +1

      @@omega72519 Ayt ty, simple

    • @IttesafHossain27
      @IttesafHossain27 Рік тому +1

      bro can I make it only spawn one?and also when I spawn a model that can walk(basically a killer model)it spawns without even touching/clicking the part,also even after i click,about 5-9 more of then spawn,what can I do about it?

    • @omega72519
      @omega72519 Рік тому

      @@IttesafHossain27 Move or offset the spawn point, the AI humanoids touch the part, causing it to repeat the spawn over and over

    • @omega72519
      @omega72519 Рік тому

      @@IttesafHossain27 If it doesn't help them I'm not sure, I've lost quite a bit of coding knowledge lately

  • @tatimih5504
    @tatimih5504 9 місяців тому

    I watched this video now after 2 years and it still works! Thank you so much!!!

  • @titoviajante
    @titoviajante 2 роки тому +3

    Excellent video. Very well explained

  • @terrysteeth
    @terrysteeth Рік тому +2

    Thx i needed this

  • @Renzie2161
    @Renzie2161 3 роки тому

    Thanks! You Helped me.

  • @seth2sick
    @seth2sick 10 місяців тому +1

    yo thanks homie

  • @kyncs1126
    @kyncs1126 3 роки тому

    you got A NEW SUB

  • @kyncs1126
    @kyncs1126 3 роки тому

    oh yeah and thx like the vids

  • @romjakedominic1112
    @romjakedominic1112 2 роки тому

    How do I make it do the opposite like when anyone even me spawns on the game, it's not created yet and will just create it if the create button is clicked?

    • @toytlking
      @toytlking  2 роки тому

      im not sure if im understanding the question correctly, so correct me if im way off, but just have it so that the model starts off in server storage, and then that should work

    • @romjakedominic1112
      @romjakedominic1112 2 роки тому

      so should I put it on both server storage and replicated storage or in workspace?

    • @toytlking
      @toytlking  2 роки тому

      @@romjakedominic1112 again, i'm not sure if i understand the question, but you would have the button take something out of serverstorage or replicatedstorage (wherever you put it) and then have it start out in serverstorage/replicatedstorage

  • @jankrol7960
    @jankrol7960 3 місяці тому

    cool video but whats the freaking script. everything's blurry

  • @worldtry5148
    @worldtry5148 Рік тому

    how do u make it so u need a certain amount of money for the model to spawn in?

    • @toytlking
      @toytlking  Рік тому

      That's a whole other video, I'll work on that today

    • @toytlking
      @toytlking  Рік тому +1

      Here you go! ua-cam.com/video/78kp3VYhzjw/v-deo.html It might take a couple more minutes to finish processing

  • @stormgaming9857
    @stormgaming9857 Рік тому

    Do you go to the school up in pairs mane I mite now you

  • @lightstriperayan5144
    @lightstriperayan5144 Рік тому

    How can you do so when the part is clicked then that part gets destroyed it's for my Skyblock game btw

    • @toytlking
      @toytlking  Рік тому

      script.Parent:Destroy
      script - identifies itself
      .Parent - identifies the parent of the script, which we want to delete
      :Destroy - destroys the part
      If the script is in a ClickDetector, it should be
      script.Parent.Parent:Destroy

    • @lightstriperayan5144
      @lightstriperayan5144 Рік тому

      Dosent work man

    • @lightstriperayan5144
      @lightstriperayan5144 Рік тому

      So i had to create my own script but it did not work 😭 i mean it did disappear but now i cant click on the other parts to make them disappear

    • @toytlking
      @toytlking  Рік тому

      @@lightstriperayan5144 send me your current script

    • @lightstriperayan5144
      @lightstriperayan5144 Рік тому

      script.Parent.MouseClick:Connect(function()
      Local Part = script.parent.parent
      Part.transparency = 1
      Part.CanCollide = false
      Part.Anchored = false
      end)

  • @adamsimo956
    @adamsimo956 2 роки тому +1

    thanks man!!!!
    but How to Create and Destroy Models by touching !!
    pls help me!!

    • @toytlking
      @toytlking  2 роки тому

      Alright, give me a few hours. I need to sleep right now, but I can help you when I wake up.

    • @adamsimo956
      @adamsimo956 2 роки тому

      Of course, take your time.🙂

    • @toytlking
      @toytlking  2 роки тому

      @@adamsimo956 Super sorry, I woke up and forgot about this until youtube gave me the notification. here's for destroying models: web.roblox.com/library/7166056290/Destroy-on-Touch-Script I'm working on the touch one

    • @toytlking
      @toytlking  2 роки тому

      @@adamsimo956 here's the create model: web.roblox.com/library/7166116423/Create-Model-on-Touch

    • @adamsimo956
      @adamsimo956 2 роки тому

      Wow, thank you very much, this is what I needed 😍😍😍 It's okay, I am the one who should apologize for tired you. Thank you again and I hope that your channel will succeed and grow more in the future 😍😍😍

  • @WHISPERZYT
    @WHISPERZYT 2 місяці тому

    How do u make it so a model disappears if u touch a part?

    • @toytlking
      @toytlking  2 місяці тому

      Instead of a click detector, you need to use a hit detector.
      script.Parent.Touched:Connect(hit)
      if (hit.Parent:FindFirstChild("Humanoid") then
      --disappear code
      end
      end
      Try this. I haven't done anything with Lua in months so the syntax may be a bit off, and also I haven't tested this, I just wrote it out in the comment editor on my phone. Just let me know if it doesn't work.

    • @WHISPERZYT
      @WHISPERZYT 2 місяці тому

      Alright thanks

    • @WHISPERZYT
      @WHISPERZYT 2 місяці тому

      @@toytlkingit works!

  • @renyekanurbaya9163
    @renyekanurbaya9163 Рік тому

    Can you make it Grouped?

    • @toytlking
      @toytlking  Рік тому

      yes, you can group it if you set the path of the model or folder to be created or destroyed in the script executing the create/destroy code

  • @crccae
    @crccae 2 роки тому +1

    he did not put the script so here script.parent.mouseclick:connect(function()
    local PC = game.replicatedstorage/PC:clone()
    PC.paret = game.workspace
    end)

    • @crccae
      @crccae 2 роки тому

      you don't have to write pc just write urs

    • @crccae
      @crccae 2 роки тому

      here is the second script script.parent.mouseclick:connect(function()
      local PC = game.replicatedstorage/turtle:clone()
      turtle.parent = game.workspace
      script.parent.parent/transperency = 1

  • @EsteIIe1989
    @EsteIIe1989 10 місяців тому

    Its not working😢! Can you make it as a model?

    • @toytlking
      @toytlking  10 місяців тому +1

      The thing you are trying to make appear and disappear is intended to be a model, yes. The buttons can be made models as long as the scripts for them are still how they should be (they still monitor for clicks from a ClickDetector that is their parent) and the actual model is still in ReplicatedStorage). It's also good to look for an error. I will also releasing an updated version on this hopefully soon because lots of the things from this are outdated now.

    • @EsteIIe1989
      @EsteIIe1989 10 місяців тому

      ​@@toytlkingi mean can you make it as a model? Or can you send the script please!

    • @toytlking
      @toytlking  10 місяців тому

      oh i understand, yeah give me a second

    • @toytlking
      @toytlking  10 місяців тому

      www.roblox.com/library/14120638179/Appearing-and-Disappearing-Turtle

    • @EsteIIe1989
      @EsteIIe1989 10 місяців тому

      @@toytlking TYSM!!

  • @coolkid_2554
    @coolkid_2554 Рік тому

    how to add a cooldown

    • @toytlking
      @toytlking  Рік тому

      add a variable called cd and have the code in an if statement that only works if cd is true. the first line you should add to the if statement would be 'cd = false' (no quotes) to make the cooldown activate and then add 'wait(a)' (no quotes) where a is the amount of seconds the cooldown should be and then below that put 'cd = true' (again no quotes)

    • @toytlking
      @toytlking  Рік тому

      if thats unclear just say and ill send the new script

  • @XFireloaderX
    @XFireloaderX 4 місяці тому

    It Does Not Work On Trains!

    • @toytlking
      @toytlking  4 місяці тому +1

      Are you using a free model for your trains? Because if so, I would recommend learning some scripting so you can make your own. Using the toolbox is great for learning, but when you can't get something to work, it's best to make it work yourself. Almost anything, including getting trains to disappear and then reappear, is possible if you know how to do it yourself. If you respond with some more details, I would be more than willing to help you with your problem.

    • @XFireloaderX
      @XFireloaderX 4 місяці тому

      Well my problem is that it literly does not delete like I used your script and did it exactly like you it just won't disappear, my game is about everything being free I mean you are free to do anything and the name of my game is Free-For-All, My New Update Includes Realistic Motorcycles, Thank you for the advice though, and yes I am using a free model, because I am broke.

    • @toytlking
      @toytlking  4 місяці тому

      @@XFireloaderX Is it throwing any errors?

    • @XFireloaderX
      @XFireloaderX Місяць тому

      ​@toytlking No It's saying Deleted Successfully! And nothing happened

    • @toytlking
      @toytlking  Місяць тому

      @@XFireloaderX Can you invite me to edit your game? Just remember to back it up before inciting random people to edit