oh, when you put it like that “exploitable bug”, makes sense
Wait that means we can also deactivate it in CoreScripts?
I don’t know why Roblox doesn’t create a function such as WaitForChildOfClass
?
function WaitForChildOfClass(instance,class)
local object = instance:FindFirstChildWhichIsA(class)
if not object then
local added
added = instance.ChildAdded:Connect(function(obj)
if obj:IsA(class) then
added:Disconnect()
return obj
end
end)
end
return object
end
local playerGui = WaitForChildOfClass(game:GetService('Players').LocalPlayer,'PlayerGui')
print(playerGui.Name)
Although obviously it would look more like this if it were actually implemented:
local playerGui = game:GetService('Players').LocalPlayer:WaitForChildOfClass('PlayerGui')
print(playerGui.Name)
I agree, but unfortunately it doesn’t seem like it’ll be added:
Before 2013, WaitForChild
used to be a function defined in a lot of scripts before it was added to the API
I’m surprised I named that function correctly without seeing that post. But honestly, I think that argument is kind of ridiculous. I don’t see how adding an engine level API would be an issue or even difficult? Sure it’s nice to path to an object without having to use WaitForChild on everything, but this is an obvious case where that’s a problem.
This is why we (or should, for those that don’t) use GetService
. Obviously it has the purpose of adding a service if it doesn’t already exist, but it also lets you get to a service if its original name has been altered. Lots of games have done this for the sake of anti-exploits (not that it matters as the exploit scripts could simply use GetService
as well). It only makes sense, especially for the sake of consistency, that we have a similar method for classes.
Plus if nothing else, here is a point in time where it should be added to fix core scripts with this exact scenario. It would be much better for them to add API specifically for this. But whatever, I’m obviously not Roblox. They’d have to edit those core scripts regardless, in order to fix this. But again, this is a clear example of why it should be a built-in feature.
This is actually an exploit which is being addressed by roblox and shouldn’t be shared publicly. I fear it is too late to delete it now though. This means that as an exploit it is not allowed nor supported by Roblox. However, since it is minor then there is no immediate risk but I would not recommend it
Not really related but interesting, it appears the the actual issue is in the Chat and not the Menu or camera because if you rename the PlayerGui and add a Folder with the name PlayerGui, the Chat will go into the Folder but the Menu works and Freecam is in the proper PlayerGui not the folder
Well that’s because it’s using WaitForChild
and searching specifically for a child named PlayerGui
. It only prevents the chat from showing up due to the folder not being a display folder. This is why Roblox should search for the PlayerGui
class rather than just waiting for anything to have a matching name.