Hello, i making a truck game and i want to make to my gui display the job offers to drive to another city how can i random the jobs and the money it gives me
I would achieve this by having a server script generate a dictionary or a folder in replicated storage containing information in a list of different options for each player (or the server if you want all players to have the same options). These options could be randomised based on a range of positions and values (or the value could be calculated based on a factor such as distance to the location). Here is an example of what a dictionary may look like:
Options = {
["Option1"] = {
["Location"] = 'String or another value to identify the location'
["Money"] = 100 -- Int value for the money
}
}
The dictionary could be sent to the client using a RemoteEvent and then after selecting an option, the client could fire a value such as ‘Option1’ to the server. The server would then read all options in the dictionary to find the associated values/option based on the value sent from the client and then load information such as the target destination based on the information in the dictionary.
If you’re unsure here is an example of how the values could be accessed from Option1:
local Location = Options['Option1']['Location']
local Money = Options['Option1']['Money']
Make sure you don’t make the client send all the information to the server when selecting an option such as the Money value as this could make it easy for players to exploit to earn more money
Hope this helps ![]()
Let me know if you have any other questions
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.