You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
To fix my script.
What is the issue? Include screenshots / videos if possible!
It’s not anchoring.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Yes.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
for _,v in pairs(target:GetChildren()) do
if v:IsA("BasePart") then
v.Anchored = true
end
end
task.wait(5)
for _,v in pairs(target:GetChildren()) do
if v:IsA("BasePart") then
v.Anchored = false
end
end
end
There seems to random end at the bottom of the script, that doesn’t belong, but I’ll just assume you only sent a snippet of your script and didn’t post your whole script. If that is the case, it’d be helpful to get more information.
To what I can see the script itself should work, as long as, the “Target” is a character model or a model/folder/etc, with BaseParts in it.
Here’s a tiny edited version of the script that may or may not wokr
for i,v in ipairs(target:GetChildren()) do
if v:IsA("Part") then
print(v.Name)
v.Anchored = true
end
end
task.wait(5)
for i,v in pairs(target:GetChildren()) do
if v:IsA("Part") then
v.Anchored = false
end
end
I found the solution, it wasn’t that part of the script, I realised I forgot to add the player parameter for the OnServerEvent, so It was anchoring myself.