I am completely lost

Im trying to make a system where a script sends changes to a object, but only shows those changes to a couple clients. If those clients click the object, it replicates the changes to everybody on the server.

I have been trying to approch this with a OOP mindset so im slightly familiar with metatables among other things. But i have only run into problems such as my tables being cyclic, not knowing anyway to send information about my newly created objects to other module scripts, among many more.

I thought I was doing well teaching myself, but I have reached my limit. What should I learn in order to achieve this system. I just know im missing something fundamental.

Im sorry if this is unclear, but I just dont know how to properly describe the situation im in.

1 Like

Is there anyway you could show what you’ve tried to do as to reach this goal? What exactly are you trying to make without stripping down what’s required to create it?

The most logical approach to this needs no OOP, you may be confusing yourself by attempting to approach this using OOP.

If you attempt to incorporate OOP into everything, you will surely run into problems.

3 Likes

Alright Ill try to go more in depth. The game I’m working on is a multiplayer “I’m on observation duty” except I try to make it actually work as a multiplayer game.

There is a Main script in which every 20 - 45 seconds it will tell the handler to change an object.

The handler will then get a random module script that will then change a specific object. The module script has two functions within it.

  • Instructions() which is supposed to change the object in a specific way.
  • OriginalState() which returns the object to its original state.

After the selected module script is gotten, It will then create a new “Special object” class. This is where the logic falls apart as I just don’t know why I am exactly doing this, but I try it anyways. Once the class is created It then sends the class to the client. Or its supposed to.

The chosen clients are the only one to see the specific changes. Unless the object is clicked which then it will replicate the object’s changes to everyone on the server. Once its revealed to everyone, it will then be able to be “fixed” after which the object will be returned to its original state.

The problem is. None of this works at all and I cant seem to be able to come up with another way to do this. I still want to create this game because I think it would be fun, but I just don’t have the knowledge to back it up.

Sorry for the word vomit, but I really do want help on this. I just need a push in the right direction nothing to crazy.

I understand what you’re asking for, but not sure how you are struggling with structuring it. Can you share some code.

Alternatively you can forget Oop and get it working then refactor it, it a much easier way to work

1 Like

Ill try dropping the OOP stuff.

I’m reluctant to show the code mostly because half way through making it I figured out It wouldn’t work so I didn’t finish it. The reason why I thought the code wouldn’t work was because I didn’t know how to share information about newly created objects to other scripts. Basically I didn’t think ahead.

As mentioned, don’t get too caught up in OOP rn. If you don’t completely understand the problem you will likely end up making an unideal representation. (Just not realizing some things in the future that will make it more complex, happens all the time)

Let’s break it down. You wish for a script to every once in a while ask another script for properties to change and for what part?

So let’s do this, have a script generate a list of properties and their changes (like {Transparency = 0}). So now these scripts just return what should be changed. Your original script now can send this data to everyone who was supposed to see the original by passing it through a remote event. The client who received it will take the list and apply those properties.

Now if a client clicks (or interacts) with it, have them send a message back through the remote event. Now the original script that sent the data knows it should finish passing all the data to every client it hasn’t already (whose scripts are automatically going to apply the property changes since they only need the message to do so)

1 Like

So to sum up you have 3 scripts. A local script whose only job is to apply any property changes when asked by its remote event. This expects a part and a dictionary of properties.

The module scripts you are requiring which generate the list of property changes.

And your core script which asks for the changes, sends it only to those initially selected, and when responded to sends the list to everyone else who hasn’t gotten it.

1 Like

Ill look into how to generate a list. Thanks for the incite I really appreciate it. Been demotivated recently because of this, so feels nice to have some kind of an idea now. Ill mark this post as a solution.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.