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

How do I find how many times a IntValue has been changed, in a certain amount of time?

Asked by 5 years ago
Edited 5 years ago

Title of the question

local Player = game.Players.LocalPlayer
local DataStore = game.ServerScriptService.DataStore
local Workspace = game.Workspace
local ReplicatedStorage = game.ReplicatedStorage
local ServerStorage = game.ServerStorage
local StarterPlayer = game.StarterPlayer


game.Players.PlayerAdded:Connect(function(plr)
    if Workspace.StarterItemsUpgraded.StarterMonitorUpgraded.ScreenGui.Active == true then
        wait(math.random(25, 40))
        plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + 1 
    elseif plr.leaderstats.Followers.Value >130 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(1,2) 
    elseif plr.leaderstats.Followers.Value >250 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(1,3)
    elseif plr.leaderstats.Followers.Value >350 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(1,4) 
    elseif plr.leaderstats.Followers.Value >410 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(2,4)
    elseif plr.leaderstats.Followers.Value >500 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(2,5) 
    elseif plr.leaderstats.Followers.Value >600 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(2,6) 
    elseif plr.leaderstats.Followers.Value >700 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(2,7) 
    elseif plr.leaderstats.Followers.Value >775 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(3,7) 
    elseif plr.leaderstats.Followers.Value >845 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(3,8) 
    elseif plr.leaderstats.Followers.Value >950 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(3,9) 
    elseif plr.leaderstats.Followers.Value >1050 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(3,9) 
    elseif plr.leaderstats.Followers.Value >1150 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(3,10) 
    elseif plr.leaderstats.Followers.Value >1275 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(4,10) 
    elseif plr.leaderstats.Followers.Value >1400 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(4,10)
    elseif plr.leaderstats.Followers.Value >1560 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(4,11) 
    elseif plr.leaderstats.Followers.Value >1700 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(4,11)
    elseif plr.leaderstats.Followers.Value >2000 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(4,12) 
    elseif plr.leaderstats.Followers.Value >2100 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(4,12) 
    elseif plr.leaderstats.Followers.Value >2150 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(4,13) 
    elseif plr.leaderstats.Followers.Value >2300 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(5,13) 
    elseif plr.leaderstats.Followers.Value >2450 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(5,13) 
    elseif plr.leaderstats.Followers.Value >2600 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(5,14) 
    elseif plr.leaderstats.Followers.Value >2750 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(5,14) 
    elseif plr.leaderstats.Followers.Value >2950 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(5,14)
    end 
end)

game.Players.PlayerAdded:Connect(function(plr)
    if Workspace.StarterItemsUpgraded.StarterMonitorUpgraded.ScreenGui.Active and plr.leaderstats.Followers.Value >130 then
        wait(math.random(120,220))
        plr.leaderstats.Subscribers.Value = plr.leaderstats.Subscribers.Value + 1 
    elseif plr.leaderstats.Subscribers.Value >30 then plr.leaderstats.Subscribers.Value = plr.leaderstats.Subscribers.Value + math.random(1,2)
    elseif plr.leaderstats.Subscribers.Value >100 then plr.leaderstats.Subscribers.Value = plr.leaderstats.Subscribers.Value + math.random(1,3)
    elseif plr.leaderstats.Subscribers.Value >150 then plr.leaderstats.Subscribers.Value = plr.leaderstats.Subscribers.Value + math.random(1,4)
    elseif plr.leaderstats.Subscribers.Value >250 then plr.leaderstats.Subscribers.Value = plr.leaderstats.Subscribers.Value + math.random(2,5)
    elseif plr.leaderstats.Subscribers.Value >300 then plr.leaderstats.Subscribers.Value = plr.leaderstats.Subscribers.Value + math.random(2,6)
    end
end)

game.Players.PlayerAdded:Connect(function(plr)
    if Workspace.StarterItemsUpgraded.StarterMonitorUpgraded.ScreenGui.Active and plr.leaderstats.Followers.Value >100 then
        wait(math.random(120,200))
        plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + math.random(1,25)

    end
end)

game.Players.PlayerAdded:Connect(function(plr)
    if game.Lighting.TimeOfDay == 24 then
       local x = 2.5


    end
end)








The last part of the script is where I am trying to make it so at the end of the day, you get the money for each subscriber you got in that day..

0
wheres ur script User#23365 30 — 5y
0
how do i found? Also, can you re-ask this question, but this time include a script to the best of your knowledge and state info about your project that will be necassary to use in the answer? EtherealTrin 45 — 5y
0
There. CoreMcNugget 15 — 5y
0
nice indenting bro http://robloxdev.com/Writing-Clean-Code /s User#19524 175 — 5y
0
I know it's not good. CoreMcNugget 15 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
local time = --time as a number this can not change throughout the script
local Intval = -- your intvalue also must be the object intvalue not a local
spawn(function()

Intval.Changed:Connect(function()
    valChanged = valCanged + 1 -- we assume it only adds one if not well not my problem
end)
while true do
    local valChanged = 0
wait(time)
print valChanged -- or do what you want
end
end)
Ad

Answer this question