I want to safely import a model without the risk of scripts running or anything going crazy from inserting an infected model while the game is running is there any way to prevent this from happening
Can you elaborate more on your problem? If my understanding is right you can use GetDescendants()
to loop through everything inside that model to check if it contains Script
or LocalScript
local SuspiciousModel = workspace.SusModel
for _ , element in pairs(SuspiciousModel:GetDescendants()) do
if element:IsA("LocalScript") or element:IsA("Script") then
SuspiciousModel:Destroy()
break
end
end
For more safety, you can import the model where is not displayed in world space first like ReplicatedStorage
or ServerStorage
From my understanding, you want to insert a model while the game is running and keep it safe from virus scripts
local blackListedList = workspace:GetDescendants()
workspace.ChildAdded:Connect(function(c)
for _,value in pairs(blackListedList) do
if c ~= value then
for _,thing in pairs(c:GetDescendants()) do
if thing:IsA("LocalScript") or thing:IsA("Script") then
game:GetService("Debris"):AddItem(thing)
end
end
end
end
end)
I also want a way to safely import a model excluding potentially harmful scripts. When importing a model in Roblox studio it provides a warning if a script is included but doesn’t have an option to import without them.