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?
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
You cant use Touched Event in the Model but you can use it in the Humanoid.
Humanoid.Touched:Connect(function(hit, limb) if hit.Name == "GrapleCopy" then hit:Destroy() end end)
Consider searching for some important information about touching humanoids here: https://developer.roblox.com/en-us/api-reference/event/Humanoid/Touched
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.