I’m working on a prop hunt styled game right now and noticed when players become props, all binds break. Events such as pressed, released etc. do not get fired at all.
To repro:
Press F
See “bind pressed” in the output and character model changed.
Press F again.
See nothing happen, no errors, printing or character change.
Seems you need to setup input action handler each time character added because changing player’s character on server side destroys local character (and thus recreates PlayerGui).
This code works for me:
As previously mentioned, this is not a bug since you store the InputContext in PlayerGui (which gets reset when your character changes) but the handler local script is in PlayerScripts (which keeps a reference to the previous InputContext which gets destroyed)
You could just store the InputContext in PlayerScripts as well to fix this
Thanks for pointing this out! Can you link to where in the documentation this is? I’ll get it updated, that advice is outdated now. Actions should be able to live anywhere now.
For some contexts, if you want the UIButton property to work properly, you did have to have your actions inside StarterGui but that bug fix is hopefully rolling out soon.
What is this fix going to look like? As far as I know, this is just a fundamental limitation with the way the StarterGui system clones everything. The InputContext tree has to be cloned with the UIButtons its InputBindings reference, so the references stay synced.
I think the best way to solve this issue is to just introduce a property similar to Script.RunContext for ScreenGuis that lets them render anywhere. That way, we can just keep static GUI and IAS trees inside ReplicatedStorage.