Refer to the video.
I’m not sure if i’m doing something wrong here or what, im just refering to script support first before i decide to file a bug for this?
What do you think?
Refer to the video.
I’m not sure if i’m doing something wrong here or what, im just refering to script support first before i decide to file a bug for this?
What do you think?
Looks. Like it’s Something todo with the object being a model remove this part and try , if it works then it’s something to do with the object not being a model, or maybe there are no objects
Also if this is being handled in oop make sure you have ObjectController.__index = ObjectController at the top
self.objects is a loose type/cannot contain Model type.
Could you please provide more code so i will know context?
Also why do you need method :Init()? can’t you just integrate it inside a constructor?
here would be the whole script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Modules = ReplicatedStorage.Modules
local Packages = ReplicatedStorage.Packages
local Timer = require(Packages.Timer)
local JanitorModule = require(Packages.Janitor)
local Signal = require(Packages.Signal)
local Network = require(ReplicatedStorage.Network.Game).misc
local ObjectController = {
objects = {};
proximityTriggered = Signal.new();
}
function ObjectController:objectPlaced(Object: Model)
local TYPE = Object:GetAttribute("_type")
local Janitor = JanitorModule.new()
if TYPE == "Conveyors" then
elseif TYPE == "Containers" then -- TBD
local Proximity = script.ProximityPrompt:Clone() -- Auto cleaned up when object is deleted
Proximity.Triggered:Connect(function()
self.proximityTriggered:Fire(TYPE, Object)
end)
Proximity.ActionText = "View Contents"
Proximity.ObjectText = Object.Name
Proximity.Parent = Object
elseif TYPE == "Droppers" then
end
Janitor:Add(function()
self.objects[Object] = nil
end)
self.objects[Object] = Janitor
end
function ObjectController:Init()
end
function ObjectController:Start()
local function verifyObjects()
for Object: Model, Janitor in self.objects do
if Object:IsDescendantOf(workspace) then
continue
end
Janitor:Destroy()
end
end
Timer.Simple(10, verifyObjects)
end
return ObjectController
I solved it turns out i just needed to type my self.objects rather than the vars
for Object: Model, Janitor in **self.objects :: {[Model]: any?}** do
Aw man using so much bloatware like “Janitor” kills me
You need to specify type to objects most likely as since it treats it as an array ig
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.