Jump to content

Recommended Posts

Hello, I'm sorry that I'm not good at English.
I created a character with a simple widget. Here's the thing.
This works very well when the server manager chooses the character. The problem is in multiplayer, when someone other than the server manager chooses the character. Widgets that should only be visible to this character are visible to other characters, and clicking on the widget doesn't function properly. Why is that? I need help, thank you always!

gundam (2).zip

9 hours ago, rukoo said:

Hello, I'm sorry that I'm not good at English.
I created a character with a simple widget. Here's the thing.
This works very well when the server manager chooses the character. The problem is in multiplayer, when someone other than the server manager chooses the character. Widgets that should only be visible to this character are visible to other characters, and clicking on the widget doesn't function properly. Why is that? I need help, thank you always!

gundam (2).zip 128.8 MB · 0 downloads

Thats happen because you are rendering the widget in the server, if you want to render it in a client you need to send a RPC to specific client, the RPC will execute a function and in this function you need to create the widget. In this case the widget will visible only for one player.

I recommend you this tutorials:

[TUTORIAL] Network Programming Complete Tutorial
New Modding RPCs API

I have a mod that use this mechanic, is the hunter hat mod, you can view the code of "pointer" that is only visible in the client who has the hat equipped. My modmain.lua is a dissaster but the part that handle which you need isn't large, just search "RPC" and find the part who says "AddRPCToClient" or something like that, the second parameter of this function describe what it do, search something like "create pointer" and the third parameter is the function that will be execute in client side. Also check the component "hunterexpert.lua", i think the last function in this code handle the RPC send, search something like RPCToClient(GetRPC(... That's all you need to render something in the client, the difference is i use a prefab and you use a widget.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...