I'm making a basketball court game. So I have a block that on touch freezes the character in order to keep them on a team spot, but if they want to exit they can, but I need them to be unfrozen, of course. This is my code for the block that will unfreeze them, but it won't unfreeze:
function touched(part)
if not game.ReplicatedStorage.RemoteEvent then end
if part.Parent:FindFirstChild('Humanoid') then
local n = part.Parent
local all = n:GetChildren()
for i=1,#all do
if all[i]:IsA("Part") then
all[i].Anchored = false
end
end
end
end
script.Parent.Touched:Connect(touched)
If anyone could help me figure this out it would be much appreciated! I'm very new to scripting.

6 comments
try GetDescendants() instead of GetChildren(), doubt it will make a difference but you might have a custom character. Also check for errors, also I'm pretty sure if you have mesh parts and unions in the user, those will stay anchored.
Didn't work sadly. I appreciate the suggestion so thank you, but the character is not a custom character either. I should have stated that the freeze is the same script but all that is changed for the unfreeze part and freeze part is whether Anchored = true or false.
@CameUpFromNothing, what doesn't work in your script? Explain more in your question, with what your goal is with examples etc.
Make sure you send us your whole script.
That's the entire script, and what I described was the exact problem. I don't really know what else to say.
idk, the code looks fine to me