Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Class properties of an object in a table without knowing its class?

Hello, I want to know if there is a way to access an object's properties as a whole, some kind of table or I don't know.

I'm trying to save objects without saving the objects themselves, with DataStores.

I don't have any code to attach to this because I have no idea how to do this q.q

1 comment

0

Can you explain the kind of object that you're trying to save, and the kind of result that you want? This question is way too vague

2 answers

✓ Accepted answer

It is not possible to access all of the properties of a ROBLOX Object. What you can do instead is save only the properties you care about, although you will have to turn the 'compound' or 'complex' properties such as Vector3s, BrickColors, or CFrames, into simpler elements, to store them.

3 comments

0

Meh but it's pretty complex, let's say I want to save parts, as well as their welds, their surfaceguis, their meshes, etc.

0

lol you just got owned by Vali

0

Not really, although I did misspeak. It is not possible to get a list of all the properties a ROBLOX object has without doing it yourself, like Validark did.

If you were to get a list of all the Properties, you could use pcall to access it and if it doesn't error you know that it is a valid property of that object.

The following is the list of properties according to this. EDIT This is my list!

local Properties = {'AASamples','AbsolutePosition','AbsoluteSize','AbsoluteWindowSize','Acceleration','AccelerometerEnabled','AccountAge','Active','Adornee','AllowTeamChangeOnTouch','AltCdnFailureCount','AltCdnSuccessCount','AlwaysOnTop','Ambient','AmbientReverb','Anchored','Angle','angularvelocity','AnimationId','Antialiasing','Archivable','AreArbitersThrottled','AreHingesDetected','AttachmentForward','AttachmentPoint','AttachmentPos','AttachmentRight','AttachmentUp','AutoAssignable','AutoButtonColor','AutoColorCharacters','AutoFRMLevel','AutoRotate','AutoRuns','AvailablePhysicalMemory','Axes','BackgroundColor3','BackgroundTransparency','side','ParamA','BackParamA','side','ParamB','BackParamB','BackSurfaceInput','BaseTextureId','BaseUrl','BinType','BlastPressure','BlastRadius','BodyPart','BorderColor3','BorderSizePixel','BottomImage','BottomParamA','BottomParamB','BottomSurfaceInput','BrickColor','Brightness','Browsable','BubbleChat','BubbleChatLifetime','BubbleChatMaxBubbles','C0','C1','CameraMaxZoomDistance','CameraMinZoomDistance','CameraMode','CameraOffset','CameraSubject','CameraType','CanBeDropped','CanCollide','CanLoadCharacterAppearance','CanvasPosition','CanvasSize','CartoonFactor','CdnFailureCount','CelestialBodiesShown','CFrame','cframe','CFrame','Character','CharacterAppearance','CharacterAutoLoads','ClassicChat','ClassName','ClearTextOnFocus','ClipsDescendants','CollisionEnabled','Color','Color3','ColorShift','Bottom','ColorShift','Top','Concurrency','ConstrainedValue','Controller','ControllingHumanoid','ConversationDistance','CoordinateFrame','CreatorId','CreatorType','CurrentAngle','CurrentCamera','CurrentLine','CustomizedTeleportUI','CycleOffset','D','DataComplexity','DataComplexityLimit','DataCost','DataModel','DataReady','DebugDisableInterpolation','Delta','Deprecated','Description','DesiredAngle','DestroyJointRadiusPercent','DevCameraOcclusionMode','DevComputerCameraMode','DevComputerCameraMovementMode','DevComputerMovementMode','DevEnableMouseLock','DevTouchCameraMode','DevTouchCameraMovementMode','DevTouchMovementMode','Disabled','DisplayDistanceType','DistanceFactor','DistributedGameTime','DopplerScale','Draggable','Duration','EagerBulkExecution','Elasticity','EmptyCutoff','Enabled','EnableFRM','EnableMouseLockOption','ErrorCount','ExplosionType','ExtentsOffset','F0','F1','F2','F3','Face','FaceId','Faces','FieldOfView','FilteringEnabled','Focus','FogColor','FogEnd','FogStart','FollowUserId','Font','FontSize','force','FormFactor','formFactor','FrameRateManager','Friction','From','FrontParamA','FrontParamB','FrontSurfaceInput','GamepadEnabled','GarbageCollectionFrequency','GarbageCollectionLimit','GearGenreSetting','Genre','GeographicLatitude','GlobalShadows','Graphic','GridSize','Grip','GripForward','GripPos','GripRight','GripUp','GyroscopeEnabled','BodyColor','HeadsUpDisplay','Health','HealthDisplayDistance','Heat','Height','Hit','HttpEnabled','Humanoid','Icon','Image','ImageColor3','ImageRectOffset','ImageRectSize','ImageTransparency','InitialPrompt','InOut','InUse','Is30FpsThrottleEnabled','IsAggregationShown','IsBackend','IsDebugging','IsFinished','IsModalDialog','IsPaused','IsPersonalServer','IsPhysicsEnvironmentalThrottled','IsPlaying','IsScriptStackTracingEnabled','IsSleepAllowed','IsSmooth','IsSynchronizedWithPhysics','IsWindows','JobId','Jump','KeyboardEnabled','KeyCode','LeftLeg','LeftParamA','LeftParamB','LeftRight','side','Surface','LeftSurfaceInput','LegacyNamingScheme','Length','Lifetime','LightEmission','lighting','LinkedSource','LocalPlayer','LocalSaveEnabled','LocalTransparencyModifier','location','Locked','Loop','Looped','ManualActivationOnly','Material','MaxActivationDistance','MaxDataModelSendBuffer','MaxExtents','maxForce','MaxHealth','MaxItems','MaxSpeed','MaxThrust','maxTorque','MaxTorque','MaxValue','MaxVelocity','MembershipType','MeshCacheSize','MeshId','MeshType','MidImage','MinReportInterval','MinValue','Modal','ModalEnabled','MouseBehavior','MouseEnabled','MouseIconEnabled','MoveDirection','MultiLine','Name','NameDisplayDistance','NameOcclusion','Neutral','NumberOfPlayers','NumPlayers','NumRunningJobs','NumSleepingJobs','NumWaitingJobs','Occupant','Offset','Opacity','Origin','OutdoorAmbient','Outlines','OverlayTextureId','P','PantsTemplate','ParallelPhysics','Parent','Part','Part0','Part1','Pitch','PlaceId','PlaceVersion','PlatformStand','PlayerToHideFrom','PlayOnRemove','Point','Port','Position','position','Position','PrimaryPart','Priority','PriorityMethod','ProcessorTime','Purpose','QualityLevel','Radius','Range','Rate','ReceiveAge','Reflectance','ReloadAssets','ReporterType','RequestQueueSize','ResetPlayerGuiOnSpawn','ResizeableFaces','ResizeIncrement','Resolution','RespawnLocation','ResponseDialog','RightLeg','RightParamA','RightParamB','RightSurfaceInput','RiseVelocity','RobloxLocked','RolloffScale','Rotation','RotSpeed','RotVelocity','Scale','ScaleEdgeSize','SchedulerDutyCycle','SchedulerRate','Score','Script','ScriptsDisabled','ScrollBarThickness','ScrollingEnabled','SeatPart','SecondaryColor','Selectable','Selected','SelectionImageObject','ShadowColor','Shadows','Shape','Shiny','ShirtTemplate','ShowBoundingBoxes','ShowDevelopmentGui','ShowInterpolationpath','Sit','Size','SizeConstraint','SizeInCells','SizeOffset','SizeRelativeOffset','SkinColor','SkyboxBk','SkyboxDn','SkyboxFt','SkyboxLf','SkyboxRt','SkyboxUp','SleepAdjustMethod','SoundId','Source','SparkleColor','SpecificGravity','Specular','Speed','StarCount','Status','Steer','StickyWheels','StreamingEnabled','StudsBetweenTextures','StudsOffset','StudsPerTileU','StudsPerTileV','Style','summary','Target','TargetFilter','TargetOffset','TargetPoint','TargetRadius','TargetSurface','TeamColor','Terrain','TestCount','Text','TextBounds','TextColor3','TextFits','TextScaled','TextStrokeColor3','TextStrokeTransparency','TextTransparency','Texture','TextureCacheSize','TextureId','TextureSize','TextWrap','TextWrapped','TextXAlignment','TextYAlignment','Thickness','ThreadAffinity','ThreadPoolConfig','ThreadPoolSize','Throttle','ThrottledJobSleepTime','ThrustD','ThrustP','Ticket','Time','TimeLength','TimeOfDay','Timeout','TimePosition','To','Tone','ToolPunchThroughDistance','ToolTip','TopBottom','TopImage','TopParamA','TopParamB','TopSurfaceInput','Torque','Torso','TouchEnabled','Transparency','TurnD','TurnP','TurnSpeed','UnitRay','UsePartColor','UserDialog','userId','UserInputState','UserInputType','Value','velocity','Velocity','VelocitySpread','Version','VertexColor','ViewportSize','ViewSizeX','ViewSizeY','VIPServerId','VirtualBytes','Visible','Volume','WalkSpeed','WalkToPart','WalkToPoint','WarnCount','Weight','WireRadius','Workspace','X','Y','ZIndex','ZOffset'}


local properties = {}
for i,v in pairs(Properties) do
	if pcall(function() return Object[v] end) then
		table.insert(properties, v)
	end
end

Also, this is very inefficient, so I would recommend not using this on the server, just for creating your own tables and strings for encoding the Instances beforehand.

EDIT This code makes a table of the properties "Object" has, and does not save the value of that property.

2 comments

0

I never used pcall before, is it some kind of table matcher or something?

This discussion is preserved as it was. New answers, comments, and votes are closed.