local function UnAnchor() for _, i in pairs(script.Parent:GetChildren()) do if i:IsA("Part") then i.Anchored = false end end end UnAnchor()?
part = script.Parent part.Touched:connect(function(unanchor) print (Meteor.name.."was touched by player" )end)
thats all my code
You are calling a function inside itself...
do this..
local function UnAnchor() for _, v in pairs(script.Parent:GetChildren()) do if v.ClassName == "Part" then v.Anchored = false end end end script.Parent.Touched:Connect(function() print("Meteor was touched by player") UnAnchor() end)
There were a couple of errors in your script
What I did... i made a loop in script.Parent:GetChildren() and made its anchor false when the player touches its parents brick
If this works for you, upvote and click accept please :)