Is it possible for multiple things to activate 1 function? For example, would this work?
Player.leaderstats.Gold.Value.Changed,Player.leaderstats.Gems.Value.Changed,Player.Exp.Value.Changed:connect(saveStats)
Is it possible for multiple things to activate 1 function? For example, would this work?
Player.leaderstats.Gold.Value.Changed,Player.leaderstats.Gems.Value.Changed,Player.Exp.Value.Changed:connect(saveStats)
Yes, but that's not the syntax. You have to use the connect method on each and every event you want to connect:
Player.leaderstats.Gold.Changed:connect(saveStats)
Player.leaderstats.Gems.Changed:connect(saveStats)
Player.Exp.Changed:connect(saveStats)
EDIT: Also, the Changed event of a ValueObject is in the object itself, not the Value property.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Oh, and also, how would I find a LocalPlayer for the connect line in a regular script? I know that LocalPlayer only works with LocalScript, so how would I do something similar with the regular scripts?
The PlayerAdded event gives you a player arguement, so just create a parameter for it! :)