I know I asked this before, and I thought I fixed it, but it wasn't fixed.
function onTouched(hit) if hit.Name=="EF1B" then hit.Anchored=false end end script.Parent.Touched:connect(onTouched)
The thing that touches EF1B is a tornado, but when the tornado touches EF1B, it doesn't unanchor. Any help?
I assume from your post that EF1B
is the part that is being touched -- script.Parent, and the tornado is named something other than EF1B
. I labeled everything so that you'd understand just what each of them represent.
The parameter assassin represents emitter (what is doing the touching), and victim is the receiver.
local victim = script.Parent -- EF1B local tornado = workspace['path to tornado'] victim.Touched:connect(function (assassin) -- whenever victim is touched if assassin and tornado and assassin:IsDescendantOf (tornado) then -- check for assassin's name victim.Anchored = true -- code end end)
Edit: set tornado
to the model and the if statement will check if assassin
is a descendant of the model, if so, the part will be unanchored.
Apart from the sloppy coding I don't see anything wrong.If you want to make the script more efficient then I suggest doing this.
script.Parent.Touched:connect(function(Hit) if Hit.Parent.Name == "EF1B" or Hit.Name == "EF1B" then--I added Hit.Parent.Name so if a Descendant of an Object touches the Tornado it will retrieve Name of the Part that its Descendant to. Hit.Anchored = false end)