Skip to content

Instantly share code, notes, and snippets.

@badcc
Last active September 13, 2024 17:53
Show Gist options
  • Save badcc/b8b5e865b1ff4b962d055df053ab50f3 to your computer and use it in GitHub Desktop.
Save badcc/b8b5e865b1ff4b962d055df053ab50f3 to your computer and use it in GitHub Desktop.
Change ClassName of Roblox instance (using Anaminus' API dump)
local ClassName = 'TextButton'
local Object = game.Selection:Get()[1]
local HttpService = game:GetService('HttpService')
local API = HttpService:JSONDecode(HttpService:GetAsync('http://anaminus.github.io/rbx/json/api/latest.json'))
local function ChangeClass(ClassName, Object, NewObject)
for _,v in next,API do
if (v['type'] == 'Class' and v['Name'] == ClassName and v['Superclass']) then
ChangeClass(v['Superclass'], Object, NewObject)
elseif (v['type'] == 'Property' and v['Class'] == ClassName) then
pcall(function() -- If property is not allowed to be changed, do not error.
NewObject[v.Name] = Object[v.Name]
end)
end
end
end
local NewObject = Instance.new(ClassName)
ChangeClass(Object.ClassName, Object, NewObject)
local a='TextButton'local b=game.Selection:Get()[1]local c=game:GetService('HttpService')local d=c:JSONDecode(c:GetAsync('http://anaminus.github.io/rbx/json/api/latest.json'))local function e(a,b,f)for g,h in next,d do if h['type']=='Class'and h['Name']==a and h['Superclass']then e(h['Superclass'],b,f)elseif h['type']=='Property'and h['Class']==a then pcall(function()f[h.Name]=b[h.Name]end)end end end;local f=Instance.new(a)e(b.ClassName,b,f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment