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... - Ігри
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
To @Toytl King
If you think this is helpful, go ahead and pin it, it does work
@@omega72519 Ayt ty, simple
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?
@@IttesafHossain27 Move or offset the spawn point, the AI humanoids touch the part, causing it to repeat the spawn over and over
@@IttesafHossain27 If it doesn't help them I'm not sure, I've lost quite a bit of coding knowledge lately
I watched this video now after 2 years and it still works! Thank you so much!!!
Excellent video. Very well explained
Thanks!
Thx i needed this
Thanks! You Helped me.
No problem!
yo thanks homie
you got A NEW SUB
thanks!
oh yeah and thx like the vids
You're welcome!
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?
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
so should I put it on both server storage and replicated storage or in workspace?
@@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
cool video but whats the freaking script. everything's blurry
how do u make it so u need a certain amount of money for the model to spawn in?
That's a whole other video, I'll work on that today
Here you go! ua-cam.com/video/78kp3VYhzjw/v-deo.html It might take a couple more minutes to finish processing
Do you go to the school up in pairs mane I mite now you
How can you do so when the part is clicked then that part gets destroyed it's for my Skyblock game btw
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
Dosent work man
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
@@lightstriperayan5144 send me your current script
script.Parent.MouseClick:Connect(function()
Local Part = script.parent.parent
Part.transparency = 1
Part.CanCollide = false
Part.Anchored = false
end)
thanks man!!!!
but How to Create and Destroy Models by touching !!
pls help me!!
Alright, give me a few hours. I need to sleep right now, but I can help you when I wake up.
Of course, take your time.🙂
@@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
@@adamsimo956 here's the create model: web.roblox.com/library/7166116423/Create-Model-on-Touch
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 😍😍😍
How do u make it so a model disappears if u touch a part?
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.
Alright thanks
@@toytlkingit works!
Can you make it Grouped?
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
he did not put the script so here script.parent.mouseclick:connect(function()
local PC = game.replicatedstorage/PC:clone()
PC.paret = game.workspace
end)
you don't have to write pc just write urs
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
Its not working😢! Can you make it as a model?
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.
@@toytlkingi mean can you make it as a model? Or can you send the script please!
oh i understand, yeah give me a second
www.roblox.com/library/14120638179/Appearing-and-Disappearing-Turtle
@@toytlking TYSM!!
how to add a cooldown
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)
if thats unclear just say and ill send the new script
It Does Not Work On Trains!
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.
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.
@@XFireloaderX Is it throwing any errors?
@toytlking No It's saying Deleted Successfully! And nothing happened
@@XFireloaderX Can you invite me to edit your game? Just remember to back it up before inciting random people to edit