Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is it possible to have multiple events activating the same function?

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)

1 answer

✓ Accepted answer

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.

2 comments

0

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?

0

The PlayerAdded event gives you a player arguement, so just create a parameter for it! :)

This discussion is preserved as it was. New answers, comments, and votes are closed.