Proximity prompt and work on elevator

This commit is contained in:
2024-03-10 21:41:10 -04:00
parent 3e28667b13
commit df86e6efb6
15 changed files with 327 additions and 177 deletions

View File

@@ -4,13 +4,14 @@
--All debugging objects such as light source indicating objects will be turned invisible
export type Entities = {IndexedEntities: {Instance}}
type HideEditor = (a1: BasePart | Folder, a2: boolean) -> ()
type LuaChangeableContainer = Script | LocalScript
local Players = game:GetService("Players")
local CS = game:GetService("CollectionService")
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 = {}
@@ -65,7 +66,7 @@ local EditorEntities = {
["LadderContact"] = HideLadderContact,
}
function StudioEntities.indexAll(enabled: boolean): Entities
function StudioEntities.indexAll(enabled: boolean)
if #StudioEntities.IndexedEntities == 0 then
--Run when the server starts
local WorkspaceEnt = workspace:GetDescendants()
@@ -93,13 +94,13 @@ function StudioEntities.indexAll(enabled: boolean): Entities
end
end
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
--mini algIsAorthim 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
pcall(function()
(Item :: LuaChangeableContainer).Enabled = false
end)
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
@@ -120,4 +121,13 @@ function StudioEntities.indexAll(enabled: boolean): Entities
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