New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

can anyone tell me whats wrong with my unanchor from other model script?

Asked by 1 year ago

hi im a beginner scripter i started like 3-4 days ago and i was trying to script a part that unanchors parts from other model but it doesnt work here is the script

local UnAnchorer = script.Parent function UnAnchor(Part) local hum = Part.Parent:findFirstChild("Humanoid") if (hum ~= nil) then local Parts = workspace.Parent.UnAnchorParts:GetChildren(Part) Parts.Anchored = false end end UnAnchorer.Touched:Connect(UnAnchor)

1 answer

Log in to vote
0
Answered by
Alphexus 429 Moderation Voter
1 year ago
Edited by User#24403 1 year ago

I hope this helps. If it did, please accept my answer. Thanks and keep on scripting! :D

script.Touched:Connect(function(hit)
    local h = hit.Parent:FindFirstChild("Humanoid")
    if h then
        for i,v in pairs([THE MODEL YOU WANT TO UNANCHOR]:GetChildren()) do
            if v:IsA("BasePart") then
                v.Anchored = false
            end
        end
    end
end)
0
Change the function to script.Parent. Sorry for the heirachry error. My bad. Again, hoped this helped. Alphexus 429 — 1y
0
doesnt work TFlanigan 82 — 1y
Ad

Answer this question