roblox-ts

R

roblox-ts

Join the community to ask questions about roblox-ts and get answers from other members.

Join

Atom with array does not update react components

any obvious reason my react component is not re-rendering when I update the atom? is this because the atom is holding an array? ```tsx // flamework controller... private _alerts: Charm.Atom<AlertContext[]> ...
Solution:
```ts private _alerts: Charm.Atom<AlertContext[]> updateMethod(alert) { const t = this._alerts((old) => {...

Adding underscore to file name changes require casing

?! The proper case is "Alerts" but it compiles to "alerts" if there is no underscore in the name? I had to disable forceConsistentCasingInFileNames because I could not figure out any other way to fix it but it was complaining about casings being different even though they were not...
Solution:
Can you restart the vsc?

syncing still not working...

why .sync don't work? i give it payloads, it don't give any error, but atom don't changes
Solution:
i think the init payload is missing
No description

Is defining generics of a Component again when it's being used, really necessary in Flamework?

Solution:
apparently you could do something like <A extends Attributes = {}, I extends Tool = Tool>...
No description

syncing dont work!!

i set up syncing with cahrm-sync but when i change server atom nothing happens! sync:connect() dont fire and subscriptions to server atom too
Solution:
charm is immutable, u should clone the tables before writing data in your updater function
server

React Context hook does not update consumer

Hello, I have yet another react question :p I am creating a datastore editor plugin and I have a list of datastore keys. Each of these is a button and when clicked, the data associated with that key should appear in the main editor. In order to do this I am using a context hook, and each key selection is a provider for the context hook. The main editor is a consumer of the hook. The context is created outside of the main component and passed in as a prop (I am not sure how else to do this, I could create the context inside the main component but I see no difference there): ```tsx onStart(): void {...

include folder not being created

I am working on a monorepo, and the include folder is not created when running the transpiler
Solution:
and as i said before, i am working on a monorepo, so my project was being treated as a package because it matches the regex
const PACKAGE_REGEX = /^@[a-z0-9-]*\//;
const PACKAGE_REGEX = /^@[a-z0-9-]*\//;
...

service instance does not replicate to client

the replication only triggered whenever i switch the simulation to the server then back to the client on testing map component is shared btw...
Solution:
SOLUTION: - run the content provider along a thread REASON: - contentprovider stalled everything...
No description

How to start with plugins + react?

I am using the Comet framework + react to make a dss editor, but I can't seem to figure out how to create a view. From what I could gather from various sources I put together this code which I'm just trying to get some random UI to show up, but it is giving me a very big error that I cannot deduce any issue from: ```tsx // src/systems/main-system.ts import { Button, Dependency, GUI, OnEnd, OnInit, System, View } from "@rbxts/comet";...
Solution:
you prob could use flamework directly for plugins (if you're familliar with flamework) i set it up here https://github.com/Velover/FlameworkPluginTemplate...
No description

Flamework Tips

Hello all, First with some context: I've been in the process of porting some games run by a group to use Rojo and even more recently I've been porting some code to use Typescript. I have familiarity with Typescript and React already. What I'm not familiar is Flamework and frameworks similar to it. ...

flamework not identifying service constructor

tl;dr services cannot be in shared I am using flamework for the first time and I'm not sure whether this is a conceptual misunderstanding or there is something I'm not seeing I have the following service (shared):...
Solution:
iirc services cant be made in shared, services is for server only, controllers is for client only, and components are for all three (client, shared, server). You'd have to make the SessionProvider service be serversided. Also for the SessionProvider you have to use the existing life-cycle events that flamework provides you with (onStart, onTick, etc...) to add logic to the listeners
Message Not Public
Sign In & Join Server To View

how to use rbxts-build in a multi-placed project

https://github.com/osyrisrblx/rbxts-build I want to use rbxts-build in a multi-place project. What settings should I write in project.json? Or is it not possible? Currently, there are main and lobby places like this. ```...
Solution:
"watch:lobby": "cd places/lobby && rbxts-build watch",
"watch:main": "cd places/main && rbxts-build watch"
"watch:lobby": "cd places/lobby && rbxts-build watch",
"watch:main": "cd places/main && rbxts-build watch"
...

How do you deal with multiple calls of FindFirstChild(), WaitForChild(), etc?

I'm new to both Rojo and Roblox-ts. One thing I noticed is that when I'm trying to access children of Instances is I'm having to repeatedly use FindFirstChild or WaitForChild or other methods and then having to use type casting or checking if the instance exists before finding the next child and so on and so forth Original luau code that looked like this: ```lua local track = self.Humanoid.Animator:LoadAnimation(ReplicatedStorage.Animations.Animation)...

Character and Skin Data Structure

I'm currently implementing a character selection system in a Roblox game and would like to hear everyone's opinions on how to structure the data. ``` // Character types (5 types) enum CharacterType { Warrior = "Warrior",...
Solution:
I would make a CharacterData const object with both the name and skins for each character
Message Not Public
Sign In & Join Server To View

Help with charm and lyra

Lyra is supposed to be the source of truth so how would I go about using charm-sync with lyra since atoms can be modified from anywhere and wont that make lyra not the source of truth

why it happens??

im not sure what is it and why it happens, anyone had this? This thing yields flamework entirely...
Solution:
it's waiting on the client cause they havent been created from the server yet
No description

Incorret t compilation with flamework

const test_guard = Flamework.createGuard<[string, ...unknown[]]>();
warn("[RESULT]", test_guard(["test", 123, "hi"])); //fails
const test_guard = Flamework.createGuard<[string, ...unknown[]]>();
warn("[RESULT]", test_guard(["test", 123, "hi"])); //fails
...

How to observe client-side data changes in Charm without React?

I'm using Charm for state management in my Roblox game and have successfully set up server-client synchronization using the official example from the charm-example repository. The server-side implementation works perfectly with the provided example. However, I'm not using React on the client side and need guidance on the best practices for observing atom changes and updating the UI accordingly. Here's my current client-side code: ```...
Solution:
you can create a custom useAtom hook
Message Not Public
Sign In & Join Server To View
Next