Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Events for changed?

Asked by
RM0d 305 Moderation Voter
11 years ago

Ive done

1player.Values.XP.Changed:connect(Update())
2player.Values.Gold.Changed:connect(Update())
3player.Values.Level.Changed:connect(Update()) -- There are about 12 more

is there a way I can make it one...

0
Can you please ask clearer? BlueTaslem 18071 — 11y
0
instead of multiple connects is it possible to make it one i dont mind using for loops but it will be a pain to change it if i decide to remove or add anything RM0d 305 — 11y

1 answer

Log in to vote
1
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
11 years ago

Maybe try this, it will run a loop though all the player values and if any of them change the event will run.

1pv = player.Values:GetChildren()
2 
3function Update()
4--Code here
5end
6 
7for i=1,#pv do
8pv[i].Changed:connect(Update()) --I am not sure if you can have a connection tell the function information... I was reluctant on having the parenthesis in there.
9end
0
i dont need args so thank you RM0d 305 — 11y
Ad

Answer this question