Fence = game.Workspace.LMF.Metal
function onTouch(Part)
Fence.Anchored = false
end
Fence.Touched:connect(onTouch)
That up there is what I tried to make,no results...
I even used model scripts to look the differences and possibly fix it,nothing aswell...
If anyone knows,please write a fixed version of mine,I'd be really thankful
PS:The model I try to unanchor is a metal fence>Large Metal Fence-LMF
First, you need to detect when the user touches something that is a child of a model.
game.Workspace.Fence.PART.Touched:connect(function() end)
Now, you need to iterate through the entire model and unanchor it.
game.Workspace.Fence.PART.Touched:connect(function() for i,v in pairs(game.Workspace.Fence:GetChildren()) do if v:IsA("Part") then v.Anchored = false; end end end)
You may want to make it detect more than just a Part.
Edit: You might also want to make it recursive!
Models do not have touched events, so I recommend placing a transparent block around the model you want to trigger the function and use that block as the new trigger. Kingdom5 already answered this but I think this might help too.
insert a script inside the part and then type:
script.Parent.touched:connect(function(hit) script.parent.Anchored=false end)