Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How To Make Reference Model Disappear When Touching?

The model I am talking about here is the one I created as a clone of a model in ReplicatedStorage but its Parent is in Workspace. So, it is only visible in the play mode. That is why I cannot address it outside of the loop down here. I can't use Destroy() or Debris:AddItem()

while wait(math.random(10,30)) do
local GrapeCopy = Grape:Clone()
GrapeCopy.Parent = workspace
GrapeCopy.Position = Generator.Position
GrapeCopy.Velocity = Vector3.new(0,-50,0)
game:GetService('Debris'):AddItem(GrapeCopy,math.random(10,15))
end

Does anyone know how to make GrapeCopy disappear when the character touches it?

3 answers

✓ Accepted answer

Get the descendants and make sure their transparency is set to 1

for _, v in pairs(GrapeCopy:GetDescendants()) do
	if v:IsA("BasePart") then
		v.Transparency = 1
	end
end

or just simply send it to replicated storage.

GrapeCopy.Parent = game.ReplicatedStorage

Just add: GrapelCopy.PrimaryPart:Destroy().

That removes the primary part of the model, and wherever the primary part goes the whole model goes. Make sure you have a primary part in the model.

If this helped please accept this answer.

This discussion is preserved as it was. New answers, comments, and votes are closed.