Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to get list of object properties?

Asked by 7 years ago

Im making plugin that gets selected object propertie's and pastes them into script, so that you don't have to specify every single property manually in script, it already writes all the objects properties for you and you only change what you want later manually in script.

Problem how could i loop through objects properties and get all it's properties names as string values and just print them out?

I looked through forums and found :GetProperties(), but it doesn't seem to work.

3 answers

Log in to vote
7
Answered by
Validark 1580 Snack Break Moderation Voter
6 years ago
Edited 6 years ago

I recently needed a function to get a table of properties of Objects, so I wrote this function. Here you go :D

01local ClassProperties do
02    -- ClassProperties is a Dictionary of sorted arrays of Properties of Classes
03    -- Pulls from anaminus.github.io
04    -- Ignores deprecated and RobloxPluginSecurity Properties
05    -- Make sure HttpService is Enabled (Roblox Studio -> Home Tab -> Game Settings -> Security -> Allow HTTP requests = "On")
06 
07    ClassProperties = {}
08    local HttpService = game:GetService("HttpService")
09 
10    local Data = HttpService:JSONDecode(HttpService:GetAsync("https://anaminus.github.io/rbx/json/api/latest.json"))
11 
12    for i = 1, #Data do
13        local Table = Data[i]
14        local Type = Table.type
15 
View all 56 lines...
Ad
Log in to vote
0
Answered by 7 years ago

There is a model for this. Just follow the instructions in the description.

https://www.roblox.com/library/59938771/GetProperties-function

Log in to vote
-2
Answered by
OfcPedroo 396 Moderation Voter
7 years ago

:GetProperties doesn't work...

There's a way, though, to actually get them; Tho it takes lots of time ;I

This is a working, print example (in a regular script):

01game.Players.PlayerAdded:connect(function(player)
02--Get Part's properties...
03    local Part = game.Workspace.Part
04    local BrickColor = Part.BrickColor
05    local Color = Part.Color
06    local Material = Part.Material
07    local Reflectance = Part.Reflectance
08    local Transparency = Part.Transparency
09    local ClassName = Part.ClassName
10    local Name = Part.Name
11    local Orientation = Part.Orientation
12    local Parent = Part.Parent
13    local Position = Part.Position
14    local RotVelocity = Part.RotVelocity
15    local Velocity = Part.Velocity
View all 29 lines...

Yes, there's at least by now no automated solution...

If this takes out your doubts, then mark as the solution please.

As always, good scripting.

2
thanks bro iuclds 720 — 4y

Answer this question