--!optimize 2 --!native --!strict --All debugging objects such as light source indicating objects will be turned invisible type HideEditor = (a1: BasePart | Folder, a2: boolean) -> () type LuaChangeableContainer = Script | LocalScript local Players: Players = game:GetService("Players") local CS: CollectionService = game:GetService("CollectionService") local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage") local ServerStorage = Storage:WaitForChild("Server") local StudioEntities = { IndexedEntities = {} } local function HidePart(Part: BasePart, enabled: boolean) Part.Transparency = enabled and 1 or .9 Part.CanCollide = false Part.CastShadow = false end local function HideIndicatorPart(Part: BasePart, enabled: boolean) local billboard_light_indicator = Part:FindFirstChildOfClass("BillboardGui") if billboard_light_indicator then if enabled then billboard_light_indicator:Destroy() end else warn("Indicator source had no image indicator", Part:GetFullName()) end HidePart(Part, enabled) end local function HideBarrierCollision(Part: BasePart, enabled: boolean) Part.Transparency = enabled and 1 or .9 Part.CastShadow = false Part.CanCollide = true end local function HideRaycastContainers(Folder: Folder, enabled: boolean) local End = Folder:WaitForChild("End") :: BasePart local Start = Folder:WaitForChild("Start") :: BasePart HidePart(Start, enabled) HidePart(End, enabled) end local function HideLadderContact(Part: BasePart, enabled: boolean) Part.Transparency = enabled and 1 or .9 Part.CanCollide = true Part.CastShadow = false end local EditorEntities = { ["LightSource"] = HideIndicatorPart, ["SoundSource"] = HideIndicatorPart, ["PulleyRopeContact"] = HidePart, ["BarrierCollision"] = HideBarrierCollision, ["StairSource"] = HideBarrierCollision, ["RaycastContainer"] = HideRaycastContainers, ["LadderContact"] = HideLadderContact, } function StudioEntities.indexAll(enabled: boolean) if #StudioEntities.IndexedEntities == 0 then --Run when the server starts local WorkspaceEnt = workspace:GetDescendants() for i = 1, #WorkspaceEnt do local Item: Instance = WorkspaceEnt[i] local Case: HideEditor = EditorEntities[Item.Name] if Case then table.insert(StudioEntities.IndexedEntities, Item) Case(Item :: BasePart | Folder, enabled) end if Item:IsA("BasePart") then Item.CanTouch = false --Do micro optimizations Item.Locked = true --Security from exploiters if not Item.Anchored and table.find(CS:GetTags(Item), "ServerGuard_Physics") then local succ, err = pcall(Item.SetNetworkOwner, Item, nil) if succ then CS:RemoveTag(Item, "ServerGuard_Physics") print(`[Server Physics Guard]: "{Item}" Networking -> "{Item:GetNetworkOwner()}", {Item:GetFullName()}`) else warn(err) end end elseif Item:IsA("LuaSourceContainer") then --Cant allow scripts outside of the framework --mini algIsAorthim to see if the script is part of the rhpid-framework character or not local Model = Item:FindFirstAncestorOfClass("Model") if Model and not Players:GetPlayerFromCharacter(Model) then if Item:IsA("Script") or Item:IsA("LocalScript") then Item.Enabled = false end Item:Destroy() warn(`Script: "{Item.Name}" ({Item.ClassName}) was removed because it was outside of the rhpid-framework boundries,`, Item:GetFullName()) end end if table.find(CS:GetTags(Item), "ServerGuard_Physics") then warn(`[Server Physics Guard]: present on a non BasePart, "{Item}", {Item:GetFullName()}`) CS:RemoveTag(Item, "ServerGuard_Physics") end end else for i = 1, #StudioEntities.IndexedEntities do local Entity: Instance = EditorEntities[i] EditorEntities[Entity.Name](Entity, enabled) end end return StudioEntities.IndexedEntities end local EditorEntities_Remote = Instance.new("BindableFunction") EditorEntities_Remote.Name = "StudioIndexedEntities" EditorEntities_Remote.Parent = ServerStorage EditorEntities_Remote.OnInvoke = function() return StudioEntities.IndexedEntities end return StudioEntities