"Isn't a valid member" but it is?

Spawn is not a valid member of Model "Workspace.__MAP.Areas.Fire.Portals.Spawn" - Client - Portal:113

--> Variables
local _L = _G._L

local Services
local Maid
local Network
local Audio
local TableUtils
local Character
local Shared
local RandomUtility
local Timer
local Create
local NumberUtility
local TableUtility
local Tags
local DictionaryUtility
local cancellableDelay
local Tracker
local AttributeUtility
local PetUtility
local EggUtility
local Eggs
local Notifications
local Purchases
local StatUtility
local Spr

--> Constants

------------->
local Portal = {_objects = {}}
Portal.__index = Portal

function Portal._init()
	Services = _L.Get {"Common", "Library", "Services"}
	Maid = _L.Get {"Common", "Library", "Classes", "Maid"} 
	Trove = _L.Get {"Common", "Library", "Classes", "Trove"} 
	Network = _L.Get {"Common", "Library", "Network"}
	Audio = _L.Get {"Common", "Library", "Audio"}
	TableUtility = _L.Get {"Common", "Library", "Utilities", "TableUtility"}
	Character = _L.Get {"Client", "Modules", "Controllers", "Character"}
	Tracker = _L.Get {"Common", "Library", "Classes", "Tracker", "Tracker"}
	Shared = _L.Get {"Common", "Modules", "Shared"}
	RandomUtility = _L.Get {"Common", "Library", "Utilities", "RandomUtility"}
	Timer = _L.Get {"Common", "Library", "Classes", "Timer"}
	Create = _L.Get {"Common", "Library", "Functions", "Create"}
	NumberUtility = _L.Get {"Common", "Library", "Utilities", "NumberUtility"}
	cancellableDelay = _L.Get {"Common", "Library", "Functions", "cancellableDelay"}
	DictionaryUtility = _L.Get {"Common", "Library", "Utilities", "DictionaryUtility"}
	AttributeUtility = _L.Get {"Common", "Library", "Utilities", "AttributeUtility"}
	PetUtility = _L.Get {"Common", "Modules", "Utilities", "PetUtility"}
	Spr = _L.Get {"Common", "Library", "Physics", "Spr"}
	UI = _L.Get {"Client", "Modules", "UI"}
	Purchases = _L.Get {"Client", "Library", "Classes", "Purchases"}
	StatUtility = _L.Get {"Common", "Modules", "Utilities", "StatUtility"}
	EggUtility = _L.Get {"Common", "Modules", "Utilities", "EggUtility"}
	PortalUtility = _L.Get {"Common", "Modules", "Utilities", "PortalUtility"}
end

function Portal._start()
	Notifications = UI.Get("Notifications")
end

function Portal.new(props)
	local self = setmetatable({}, Portal)

	self._instance = props.instance
	self._player_controller = props.player_controller

	self._from = self._instance.Parent.Parent.Name
	self._to = self._instance.name

	self._last_use = nil

	self._info = PortalUtility.getInfo(self._to)

	self._trove = Trove.new()

	self:_construct()

	return self
end

function Portal:_construct()
	self:_setup()

	Portal._objects[self._instance] = self

	self._trove:Add(function()
		Portal._objects[self._instance] = nil
	end)
end

function Portal:_setup()
	local nextt = _L.Map.Areas:FindFirstChild(self._to).Portals:FindFirstChild(self._from)

	self._trove:Add(self._instance.World.Touched:Connect(function(hit)
		local c = hit.Parent
		if c then
			local p = Services.Players:GetPlayerFromCharacter(c)
			if p == _L.Player then
				if (tick() - (self._last_use or 0)) >= 1 then
					self._last_use = tick()

					local f, l = self:is_unlocked(self._player_controller._data:Get({"stats", "Strength"}))

					if f then
						local characterController = self._player_controller._character_controller

						if characterController then
							self._last_use = tick()
							c:PivotTo(nextt.Spawn.CFrame - Vector3.new(0, nextt.Spawn.Size.Y / 2 - characterController:get_height() * characterController:get_ratio(), 0))
						end
					elseif l then
						Notifications:add({
							text = "❌ "..NumberUtility.short(l).." Strength left to unlock the portal!",
							color = Color3.fromRGB(255, 0, 0),
							audio = {name = "Fail1"}
						})
					end
				end
			end
		end
	end))

	local lockInstance = self._instance:FindFirstChild("Lock")

	if lockInstance then
		self._trove:Add(self._player_controller._data:Bind({"stats", "Strength"}, function(value)
			lockInstance.Parent = if self:is_unlocked(value) then nil else self._instance 
		end))
	end
end

function Portal:is_unlocked(value)
	local unlocked = true
	if self._info.required then
		local left = self._info.required - value
		if left <= 0 then
			return true
		else
			return false, left
		end
	end
	return true
end

function Portal:Destroy()
	self._trove:Destroy()
end

return Portal

GO TO LINE 113

I don’t understand why my issue is occuring
image
its clearly there!

WaitforChild does nothing.

1 Like

I’ve had this same issue before, some how dragging the script into a different section i.e. workspace, replicated storage, etc. then dragging it back to its original location fixed it for me. I have zero clue as to why this occurs and like you said I also tried different ways of getting the gui, part I want like WaitForChild(), etc.

Hope this works for you aswell!

In that case could just be a studio bug or something, let me try right now!

I’ve had this issue in my game for about a year, I’ve tried migrating it to different places and had the same errors.

1 Like

Seems like it didn’t work? Not sure why, moved it to repstorage, played, moved it back.

Try creating a completely new script, not duplicating it, etc and copy over the code, that also worked for me.

Ok but I have multiple portals, and other ones work. Only this one doesn’t! should I still do that?

I would still try it in my opinion

Nope, still diidn’t work sadly.

You said to look at line 113, but there are no line numbers displayed in copy/pasted scripts.

Spawn.Portals.Fire.Spawn is the location you show in your heirarchy, but that doesn’ t match the error location.

I am sorry but now I get a different error.
World is not a valid member of Model "Workspace.__MAP.Areas.Fire.Portals.Spawn" - Client - Portal:98
image
Clearly it is a member.

Spawn is not a valid member of Model “Workspace.__MAP.Areas.Fire.Portals.Spawn” - Client - Portal:113

Now it’s back to this, what the hell is going on?

Yeah, that seems like roblox lol I’ve done this before and gotten new errors as well, try moving the parts, scripts, etc. all I can tell you to do is to fiddle around with it.

You can also either try migrating it over to a different place or re-write the script in a different script. I also had to do that as well.

I’m trying, it’s an amazing multi-billion dollar company!

Is World actually referenced on line 98 of your Client script?

self._trove:Add(self._instance.World.Touched:Connect(function(hit)
Yep!

image
WAit hold on, for some reason this seem to have nothing in it.
I’m using streaming from roblox, how can I exclude a part?
@scottify

Issue and Solution:
Roblox streaming, was able to disable it.

Something like this:

local function excludePart()
    for _, part in pairs(workspace:GetDescendants()) do
        if part:IsA("BasePart") and ~= part:IsA("Part") then
               -- whatever here
        end
    end
end