Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Module Scripts Client To Server Side?

Is it possible for a player to change the data within in a module Script from the client and affect the server? Lets say module is

ItemPrices = {100, 200, 300}
return ItemPrices

For example lets say the price of an item is stored in a module script. If an exploiter would change the price of that item in the module script on the client side lets say running a script with the following code:

require(game.ReplicatedStorage.ItemPrices)[1] = 0

Would that change the value of the module script on the server side? Or only for the players client? For example right after the exploiter runs that script lets say I were to print on the server the price of Item 1. Would it print 100 or 0?

2 comments

0

psst don't forget to accept if i helped

0

Yes since they are just numbers after all, they're not bound to the mouse

1 answer

✓ Accepted answer

No. It would not.

When a module script is required, it runs in the environment it is being required in. So modules required by local scripts can use Players.LocalPlayer, handle user input, etc. If a server script required that module it couldn't do that. In short, modules required by server scripts run in server environment and modules required by local ones are ran in client environment. The same rules are followed.

So if you require from a local script, a server script should require it and get the proper values.

4 comments

0

Thanks a ton! It was driving me crazy I was going worried. If you dont mind me asking where did you find this information?

1

Experience. Just binge-read the developer hub and keep experimenting with things

0

im not a professional but is it possible to pass in values like the player's mouse?

0

like Mouse.Hit.X etc?

This discussion is preserved as it was. New answers, comments, and votes are closed.