remove scripts that are not part of the framework

This commit is contained in:
2023-12-26 02:40:56 -05:00
parent 32292c933d
commit 24f0c45c8c

View File

@@ -1,5 +1,7 @@
--All debugging objects such as light source indicating objects will be turned invisible
local Players = game:GetService("Players")
export type Entities = {
IndexedEntities: {Instance}
}
@@ -38,9 +40,20 @@ function StudioEntities.indexAll(enabled: boolean): Entities
Case(Item, enabled)
end
--Do micro optimizations here
if Item:IsA("BasePart") then
if Item:IsA("BasePart") then --Do micro optimizations
Item.CanTouch = false
elseif Item:IsA("LuaSourceContainer") then --Cant allow scripts outside of the framework
--mini algorthim to see if the script is part of the rhpid-framework character or not
local Model = Item:FindFirstAncestorOfClass("Model")
if not Players:GetPlayerFromCharacter(Model) then
local Path = Item:GetFullName()
pcall(function()
Item.Enabled = false
end)
Item:Destroy()
warn(`Script: "{Item.Name}" ({Item.ClassName}) was removed because it was outside of the rhpid-framework boundries,`, Path)
end
end
end
else