{"id":"xactlyblue/rocomponents","name":"rocomponents","scope":"xactlyblue","platform":"roblox","description":"Mirrored from the Wally registry.","version":"0.1.4","latest":"0.1.4","versions":["0.0.1","0.0.3","0.0.5","0.0.6","0.0.7","0.0.8","0.0.9","0.1.0","0.1.1","0.1.2","0.1.4"],"license":"Apache-2.0","licenseRating":"safe","licenseCaveats":["Modified files must carry a notice of changes. If the package ships a NOTICE file, its attributions must be preserved.","License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{},"integrity":"167fbfb90d25a30f3e5aff1aad3f8c65e959a6e2489d2b9f231fe340a6d2f953","likes":0,"downloads":0,"install":"forest install xactlyblue/rocomponents","url":"https://forest.dev/p/roblox/xactlyblue/rocomponents","files":"https://api.forest.dev/ai/package/roblox/xactlyblue/rocomponents/files","readme":"# Rocomponents\r\nA component library for Roblox, allowing you to add more functionality to parts of your project.\r\nThis library allows you to add further functionality to code that manipulates or interacts with\r\ninstances, and in an organized and readable manner!\r\n\r\n## Installation\r\n### Wally\r\n[Wally](https://github.com/UpliftGames/wally) is a package manager for ROBLOX, and can help you\r\neasily install Rocomponents in to your project. Simply, add this block of code to your ``wally.toml`` file\r\nunder the dependencies category.\r\n\r\n```\r\nRocomponents = \"xactlyblue/rocomponents@0.0.1\"\r\n```\r\n\r\n### Rojo\r\nTo use this library, simply git-clone the source code into your target folder\r\nand rojo will take care of the rest!\r\n\r\n``git clone \"https://github.com/xactlyblue/rocomponents\"``\r\n\r\n## Documentation\r\nUnfortunately, this is a relatively new library, and does not yet have in-depth documentation.\r\nHowever, there are a few basic examples listed below to help you get a good idea of it's function. \r\n\r\n## Basic Examples\r\nThis is a simple example of a nametag-component; a billboard-gui displaying the player's name above their head!\r\n\r\nUsing the following example, you can refer to the nametag as a component, which itself can your own defined\r\nfunctions as an object-oriented object. You can easily modify the instance it is bound to, and easily clean\r\nup when you're done using the ``Cache`` instance \r\n\r\nIf you would like to see the example place [here](https://www.roblox.com/games/9611485319/Rocomponents-Example).\r\n\r\n**Note:** If you'd like, you could even add a re-enable the commented out call to unbind the component afterwards to see the unbinding procedures!\r\n\r\n```lua\r\n-- Require the rocomponents module!\r\nlocal Rocomponents = require(game:GetService(\"ReplicatedStorage\").Rocomponents)\r\n\r\n-- The ROBLOX services we might need!\r\nlocal Players = game:GetService(\"Players\")\r\nlocal ReplicatedStorage = game:GetService(\"ReplicatedStorage\")\r\nlocal HttpService = game:GetService(\"HttpService\")\r\n\r\n-- Create the component settings to make sure it's always initialized correctly!\r\nlocal NametagComponentSettings = Rocomponents.ComponentSettings.extend({\r\n\t[\"name\"] = \"string\",\r\n\t[\"subtitle\"] = \"string\",\r\n})\r\n-- The actual component we will be using!\r\nlocal NametagComponent = Rocomponents.Component.extend(\"Nametag\", NametagComponentSettings)\r\n\r\n-- The initialization function!\r\nfunction NametagComponent:init()\r\n\tprint(\"Woah... a nametag component was created o.O\")\r\nend\r\n\r\n-- Add the nametag gui to the instance the component is binded to!\r\nfunction NametagComponent:onBinded(instance)\r\n\tlocal arguments = self:getArguments()\r\n\tlocal name, subtitle = arguments.name, arguments.subtitle\r\n\t\r\n\tlocal clone = script:WaitForChild(\"Nametag\"):Clone()\r\n\tclone.Name = \"Nametag\"\r\n\tclone.Parent = instance:WaitForChild(\"Head\")\r\n\t\r\n\tclone:WaitForChild(\"Name\").Text = name\r\n\tclone:WaitForChild(\"Subtitle\").Text = subtitle\r\n\t\r\n\tself.cache.instance = clone\r\nend\r\n\r\n-- When a player joins the game, add a nametag to their character when it loads!\r\nPlayers.PlayerAdded:Connect(function(player)\r\n\tlocal function onCharacterAdded(character)\r\n\t\t-- Create and bind the component to the character!\r\n\t\tlocal component = Rocomponents.bindComponent(NametagComponent, character, {\r\n\t\t\tname = player.Name,\r\n\t\t\tsubtitle = \"The One And Only!\"\r\n\t\t})\r\n\r\n\t\t-- Optional:\r\n\t\t-- task.delay(10, function() Rocomponents.unbindComponent(component) end)\r\n\tend\r\n\r\n\t-- Connect the character added function.\r\n\tplayer.CharacterAdded:Connect(onCharacterAdded)\r\nend)\r\n```\r\n\r\nCreated by [thunderbeast208/xactlyblue](https://www.roblox.com/users/106984434/profile)\r\n","readmeTruncated":false}