I am trying to create a script where if a Part is close to the user no matter how hard the character trys to get close to it. It will keep that character a distance away from that part. Here is what I have so far :
local function Start(Character) local HumanoidRootPart = Character:WaitForChild('HumanoidRootPart') local PartStorage = workspace:WaitForChild('PartStorage'); for Index, Object in pairs(PartStorage:GetChildren()) do spawn(function() if Object:IsA("BasePart") and not Framework.IgnoredAttackTypes[Object.Name] then Framework.TempParts[Object] = Object print(Object) end end) end PartStorage.DescendantAdded:connect(function(Object) if Object:IsA("BasePart") and not Framework.IgnoredAttackTypes[Object.Name] then Framework.TempParts[Object] = Object end end) PartStorage.DescendantRemoving:connect(function(Object) if Framework.TempParts[Object] then Framework.TempParts[Object] = nil end end) while HumanoidRootPart do wait() if Framework.settings.Enabled then for Index, Object in pairs(Framework.TempParts) do spawn(function() local magnitude = (Object.Position - HumanoidRootPart.Position).magnitude if magnitude < 10 then end end) end end end end