Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can a table made in a local script be accessed by another local script?

Asked by 6 years ago

Hi there, I'm working on a train system that has a custom route setting and so far I've got it to the stage where the player can select which route they want to take and it adds them to a table however I need to somehow access the table from another local script in order for it to change the tracks so that the train can follow its route. Is this possible or do I need to try make them into 1 script? Thanks :)

TL;DR - Can a table made in a local script be accessed by another local script without anything other than just making the script or do I need to try make it into 1 single script?

Currently the table is named "Stations"

0
The table will not be available to the local script of a completely different client; however through ModuleScripts and bindables you could do for the same client. User#24403 69 — 6y
1
yes, you can use _G , shared, and module scripts theking48989987 2147 — 6y
0
But that's unrecommended; it gets messy. User#24403 69 — 6y
1
Would it be accessable to the same client as the one that the table created on? If so how would I define the table? Would it just be something like "local table = Stations" or something? Thanks kieranhendy 28 — 6y
View all comments (4 more)
1
As I said, use modules and/or bindables. User#24403 69 — 6y
0
you define a table with a set of squiggly brackets like : local tbl = {143,564,632} theking48989987 2147 — 6y
0
Ok thank you kieranhendy 28 — 6y
0
You can use remote events to send data to other clients. You can use bindable events to access other scripts on the same client that fired them. User#21908 42 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Answered in comments

Ad

Answer this question