Hey guys,
I'm in the middle of making a tycoon, but I'm stuck on one thing:
I have an IntValue in the Player, and I want to script it that when the value is 25,50,75 or 100, the player earns a Player Point. I tried this script but I realized that is would only work once, which is what I don't want.
if script.Parent.Value == 25 or 50 or 75 or 100 then game:GetService("PointsService"):AwardPoints(script.Parent.Parent.userId, 1) end
I forgot the event, but it was an event that waits until the value is either this that or that
Well, first, it's not if script.Parent.Value == 25 or 50 or 75 or 100 then
.
You need to do if script.Parent.Value == 25 or script.Parent.Value == 50 or script.Parent.Value == 75 or script.Parent.Value == 100 then
Anyways,
I would use a changed event. It fires every time the value is changed.
local val = script.Parent val.Changed:connect(function() --code here end)
You could also use a while loop,
local val = script.Parent while val.Value == 25 or val.Value == 50 or val.Value == 75 or val.Value == 100 do --code here end