Hi, I want it so that when a players leaderstat value of ‘Kills’ reaches a value, say 1000, it adds a new sword to the players inventory, but I’m not sure how to detect when a players Kills value reaches the required value without just doing something like a while loop but I feel like that would be a very inefficient way.
3 Likes
I think you could just use script.Parent.Value:GetPropertyChangedSignal("Value")
. Then just check if the value is equal to 100 kills, make it call a function.
Or when you’re firing an event or adding, in that check if the kills are over 100.
1 Like
Ah ok thanks, where would that script be located to use ‘script.Parent.Value’ ?
Sorry, that would be any script, the thing I am actually talking about is theleaderstatvalue:GetPropertyChangedSignal("Value")
This GetPropertychangedsignal, will run when a property changes. Example:
theleaderstatvalue:GetPropertyChangedSignal("Value"):Connect(function()
print("Value just changed")
end)
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.