Getting Properties of an Instance

hello thank you i’m new

  1. What do you want to achieve? Keep it simple and clear!
    I want to create a UI that displays the properties of an instance when you press r on an instance.
  2. What is the issue? Include screenshots / videos if possible!
    I have no idea how to get the properties of an object.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve thought of accounting for every single property an instance can have but I have not tried it.

here’s my code so far

-- local script
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessedEvent)
	if gameProcessedEvent then return end
	if input.KeyCode == Enum.KeyCode.R then
		local target = mouse.Target
		-- stuck here
	end
end)

Been a while since I have programmed with lua, but I believe you could either check for every property (which would be tedious)
if part.Name then

Or assign values to each part. So you have 12 properties one named “BrickColor” with a string value of the color.

1 Like

Yep. To get properties and set properties

--Get properties
local part1 = game.workspace.Part1
local part1col = part1.BrickColor

local part2 = game.workspace.Part2
local part2name = part2.Name

--Setting Properties
local part1 = game.workspace.Part1
part1.Name = "PartNew"
part1.BrickColor = BrickColor.new("Really Red")

--Orientation
local part1 = game.workspace.Part1
part1.Orientation = Vector3.new(100,120,90)

Hope this helps.

1 Like

Assuming you mean how to get each property in a table, from what I know you can’t do this in Roblox-lua. You could manually add each property yourself or you could make an HTTP request on developer.roblox.com through a proxy to try and grab the properties from there.

1 Like

How would I make an HTTP request?

1 Like

You can use HttpService which has functions for making GET, POST and other requests. Keep in mind that you can’t make any request to roblox.com or any of it’s subdomains so you’d have to use a proxy such as rprxy.xyz or something else.

1 Like