I need help with deleting a random model out of model

1.What I would like to get? // I would like to make one of the models get removed when I’ll use the Proximity Prompt. (in the Juice.Juices.Model)
2. What’s wrong with that? // The script is removing every model and not just one

I’ve tried finding solutions on the DevHub but I coudn’t find any.

local Juices = script.Parent.Parent.Parent.Juices.Model

script.Parent.Triggered:Connect(function()	

Juices:GetDescendants()
math.random(1, 13) Juices:Remove()

end)

There’s the photo of Explorer.

to make one random model inside of juices get deleted please do:

local Juices = script.Parent.Parent.Parent.Juices.Model

script.Parent.Triggered:Connect(function()	

local pull_from = Juices:GetChildren()

local random_model = math.random(1, #pull_from)

pull_from[random_model]:Remove()

end)
2 Likes

Thank you really much. It will help with later progress of my game.

2 Likes

No problem, always happy to help :steamhappy:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.