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
10 years ago

Ive done

player.Values.XP.Changed:connect(Update())
player.Values.Gold.Changed:connect(Update())
player.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 — 10y
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 — 10y

1 answer

Log in to vote
1
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
10 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.

pv = player.Values:GetChildren()

function Update()
--Code here
end

for i=1,#pv do
pv[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.
end
0
i dont need args so thank you RM0d 305 — 10y
Ad

Answer this question