diff --git a/src/server/Studio/EditorEntities.lua b/src/server/Studio/EditorEntities.lua index 6d2eef2..6348408 100644 --- a/src/server/Studio/EditorEntities.lua +++ b/src/server/Studio/EditorEntities.lua @@ -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