BakOp209
(BerlinTatraFan)
August 14, 2025, 10:51pm
1
Hello Guy’s,
i am Trying to make a Roller display (Picture 1)
and need a Global Table with Informations for the scirpts but i have no clue about Module Scirpt’s
hope Someone can help me
Table i need:
local Ziele = {
{0, ""};
{1, "Dienstfahrt"};
{1, "Sonderfahrt"};
{1, "Fahrschule"};
{0, "Schmellwitz"}
}
local Linien = {
{0, ""};
{1, "E"};
{1, "S"};
{0, "1"};
{0, "2"}
}
How can i read the Table’s form other Script’s?
Thank You for Helping!
Make a ModuleScript inside ReplicatedStorage, or wherever your trying to access this, then use this code inside:
return {
Ziele = {
{0, ""};
{1, "Dienstfahrt"};
{1, "Sonderfahrt"};
{1, "Fahrschule"};
{0, "Schmellwitz"}
},
Linien = {
{0, ""};
{1, "E"};
{1, "S"};
{0, "1"};
{0, "2"}
},
}
Then just require the script inside any of your other scripts like this:
local RollerData = require(Path.to.Module) -- The path to the module above.
And you should be able to access the data like normal using the . operator.
I highly suggest you learn about modules, they are probably one of the best tools for you to organise your scripts, and for things like this.
OR if you really don’t want modules you can do _G or shared
I don’t recommend you to use this because they are less optimized.
But if you really need something easy you can just do:
_G.Ziele = {
{0, ""};
{1, "Dienstfahrt"};
{1, "Sonderfahrt"};
{1, "Fahrschule"};
{0, "Schmellwitz"}
}
_G.Linien = {
{0, ""};
{1, "E"};
{1, "S"};
{0, "1"};
{0, "2"}
}
to add onto what skelly said u can make your life easier by storing your destinations like this. this is how i would store mine but u can do whatever u like!
Ziele module:
return {
Anfang = {
Liniennummer = 0,
Linien = "A",
Ziel = "Anfang"
},
Dienstfahrt = {
Liniennummer = 1,
Linien = "E",
Ziel = "Dienstfahrt"
},
Sonderfahrt = {
Liniennummer = 1,
Linien = "S",
Ziel = "Sonderfahrt"
},
Fahrschule = {
Liniennummer = 1,
Linien = "R",
Ziel = "Fahrschule"
},
Schmellwitz = {
Liniennummer = 0,
Linien = "H",
Ziel = "Schmellwitz"
}
}
server script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Ziele = require(ReplicatedStorage.Ziele)
print(Ziele.Fahrschule.Linien)
-- "R"
print(Ziele.Fahrschule.Ziel)
-- Fahrschule
print(Ziele.Fahrschule.Liniennummer)
-- 1
RollerDisplay.rbxl (57.7 KB)
BakOp209
(BerlinTatraFan)
August 15, 2025, 7:41am
5
First, Thank You to you all Guy’s!
but I cannot call the tables in other scripts, the tables are recognized as a function?
What does your module script currently look like and also what is the Datensatz variable referenced to?
No not really, you have a syntax error.
An incomplete statement usually happens when you use a value, but you don’t do anything with it, like reassigning it, or storing it in a variable.
If your module is exactly the same as I provided, you can just do this:
local value = Datensatz.Linien[1][2]