roblox-ts

R

roblox-ts

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

Join

Flamework Shared Components Help Needed

I created a simple game where you click an object to earn points. I’d like to refactor it using shared components, but I’m not sure how to do it properly. The code works, but not in the best way, so I need someone with more experience to guide me on how to structure it correctly. https://github.com/sdxqw/CandyCraze...

ProfileService and Services

CandyService start faster than PlayerDataService, could someone help me? CandyService.ts https://pastecode.io/s/72064zpd ...

How to create custom clone method for typescript class.

I'm trying to recreate the
Instance.Clone()
Instance.Clone()
method, but cloning a typescript class instance instead of a roblox instance, I just can't figure out how to do it while keeping the methods and functionality the same. I've tried: The spread operator (
{ ...instance }
{ ...instance }
), copy/deepCopy from the object-utils package (
Object.deepCopy(instance)
Object.deepCopy(instance)
) ```ts...
Solution:
If anyone has this same issue just use
table.clone(instance)
table.clone(instance)
Thanks bitsplicer...

Flamework + React

Hello guys, I want to know if this project is done in the correct way, and if someone could help me fix the responsivess of my UIs, as still I don't understand them, if someone is that great to help me improve this project I will be really happy. https://github.com/sdxqw/Test...

[Flamework]: Failed to load! TS version mismatch detected

I keep getting this message, i don't know how to fix it. I have 5.2.2 installed on NPM and bun. package.json: ```json { "name": "zoo-game-ts",...
No description

how to type an empty message with tether

i want the message to be empty similar to Event:FireEvent()
Solution:
this worked
[messages.CLIENT_READY]: undefined;
[messages.CLIENT_READY]: undefined;
...

ECS tips?

I'm going to try ECS. (JECS to be more precise) are there any tips on how to use it that I can use? Perhaps something should not be used, or, on the contrary, more than others. Maybe there is a template.
Solution:
go to the jecs project channel in ROSS and look through the pins in there
Message Not Public
Sign In & Join Server To View

@rbxts/jabby errors when required

Solution:
the solution was changing the @rbxts/jabby/out/jabby import to @rbxts/jabby
No description

getting mismatched data when using @rbxts/yetanothernet

Server Code ```ts const syncer = server({ atoms }); syncer.connect((player, payload) => {...
No description

Humanoid Pathfinding jump issue

Notice how my pathfinding produces a two jump waypoints (marked in red). But it only jumps for 1 of them? Why is that?

Flamework TestEZ

Are there any examples of how to test services or controllers? I figure I'd have to use the Dependency macro, but I'm unsure how.

rbxts/Jabby Vide Dependency Causing Errors in React Code

I am in the process of porting over my react code over a different project that uses Jecs with Jabby, the code is fully functional on previous project, but the presence of Jabby with the Vide dependency is causing errors in the new one
Solution:
> Clear the content of index.d.ts in node_modules/@rbxts/vide/src (do NOT delete it, that will cause compile errors) > npx patch-package @rbxts/vide to automatically apply patch on later installs...
No description

How to mock a library function in jest

I tried doing .spyOn to spy on the function but it didn't work. I don't think .mock works because it requires a module script, and roblox-ts strings will mess up its mockings

lapis readonly

I'm trying to create a wrapper function that simplifies reading and writing player data. However, I'm encountering an error that says: "attempt to modify readonly table." Lapis is returning the data as a readonly table, so I need a way to safely create a mutable copy of this data, modify it, and then send it back to be written. ...

Proper cleanup if component errored

Is flamework doing a proper cleanup if the component errors in the constructor and/or in OnStart. cc: @Fireboltofdeath...

How to make discriminated union exhaustive while using t

```ts const GAME_MODES = ["STANDARD", "TOURNAMENT", "CRAZY"] as const; export type GameMode = (typeof GAME_MODES)[number]; export const gameModeToNameMap: Record<GameMode, string> = {...
Solution:
Apparently flamework/core is enough

Property 'values' does not exist on type 'Map<...>' change the 'lib' compiler option to 'es2015'+

Property 'values' does not exist on type 'Map<string, ReactElement<({ text, colour, valueInstance, maximumInstance, valueParam, maximumParam }: ValueBarProps) => Element, string | JSXElementConstructor<any>>>'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.ts(2550)
Property 'values' does not exist on type 'Map<string, ReactElement<({ text, colour, valueInstance, maximumInstance, valueParam, maximumParam }: ValueBarProps) => Element, string | JSXElementConstructor<any>>>'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.ts(2550)
i already changed that but the compiler doesn't recognize my changes to tsconfig!...
Solution:
Use https://www.npmjs.com/package/@rbxts/object-utils, then Object.values(yourMap)

getComponents returns nothing even when it should

hello I have script like this ```ts if (this.socketAddress.address === 0) { const components = Dependency<Components>();...
Next