So, while creating a map in a place, i started getting this error:
10:28:37.932 The current identity (2) cannot Class security check (lacking permission 6)
What does it mean?
This started happening after i made this script to teleport the Player to a “Spawn”:
local S = {}
S.AssignedSpawn = "Spawn"
function S.Spawn(c: Model?)
local Location
for _,i in pairs(game:GetDescendants()) do
if i:IsA("Part") and i.Name == S.AssignedSpawn then
Location = (i.CFrame * CFrame.new(0,2,0))
end
end
return c:PivotTo(Location)
end
return S
Why are you checking the game's descendants? If you want it to teleport the Player to a Spawn, why not just use workspace:GetDescendants()? This is why the error happens.
Amongst CoreGui, it might also access multiple other normally hidden (in the Explorer) services. They are not accessible if they do not have functions/events/properties open for us to use.
The only thing I can think of is that the iterator found your Spawn part before it found a Roblox-locked service.
No, what you’ve been told is exactly the problem here. You cannot index anything on these locked services, not all descendants under game are allowed to be used. When you index that descendant (by calling IsA on it), Roblox throws an error, since it’s forbidden to use the object. You should be using workspace instead of game as previously suggested.
You should still fix it. The order in which instances are put is random, and this error will (100%) happen in the future. Just because it works now doesn’t mean that it will in the future - you should fix it.
yes the solution would be to iterate through the workspace for your spawn point not the gameInstance. and yeah as mentioned you shouldnt just igrone it now that it randomly disappeared it can occur in the future its always a good practice to fix it now in my opinion.