Answered by
6 years ago Edited 6 years ago
What the best thing to do would be to store all your information in a Library (which is a type of table) inside of a Module Script
on the Server Side. The Server is the best place to store this type of information because it's more secure from exploiters rather than keeping it completely visible and view-able on the client.
A Module Script
takes the whatever side you put it on, Server or Client. ReplicatedFirst would be Client while ServerScriptService would be Server.
To access it from the client, you would want to use a RemoteFunction
to Invoke the server and return the data you need.
Example...
Library
1 | local data = { sword = { damage = 5 , cooldown = 1 } , |
2 | bow = { damage = 10 , cooldown = 1.5 } |
LibraryConnector Script
1 | local LibraryConnector = game.ReplicatedStorage.LibraryConnector |
2 | local Library = require(game.ServerScriptService.Library) |
4 | local function onDataRequested(player, object) |
5 | return Library.getData(object) |
8 | LibraryConnector.OnServerInvoke = onDataRequested |
Client Local Script
1 | local LibraryConnector = game.ReplicatedStorage.LibraryConnector |
3 | local swordData = LibraryConnector:InvokeServer( "sword" ) |
Helpful link for understanding...
Remote Functions/Events