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

Hey can someone help me figure out how to add a number to a value(Int Value)?

Asked by 3 years ago

I want my Int value to go up one every 30 seconds while in a true do loop, but I don't know how to add a number to a value here is my script so far:


local Wins = Instance.new("IntValue") Wins.Parent = leaderstats Wins.Name = "Wins" while true do --here is where I'm supposed to add to the int value but I don't know-how. end

Note: This is in a function.

2 answers

Log in to vote
2
Answered by 3 years ago
Edited 3 years ago

Here is the wiki for Variables https://developer.roblox.com/en-us/articles/Variables

You can look through there, and if that doesn't help here is a sample script

while true do
    Wins.Value = Wins.Value + 1 -- The value of Wins turns into the value of Wins + 1 (1+1 = 2, 2+1 = 3, etc...)
    wait(30)
end

--[[
OFF TOPIC
You can also do while wait(30) do
]]
1
thanks I thought it was wrong since subtraction isn't the same StevenElijah7019 57 — 3y
0
You're welcome, here is the link to the Operators wiki for more info: https://developer.roblox.com/en-us/articles/Operators Omq_ItzJasmin 666 — 3y
Ad
Log in to vote
1
Answered by
kjljixx 42
3 years ago
while true do
    wait(30.1)--extra 0.1 secs for processing, feel free to change it back depending on how long --it takes
    Wins.Value+=1

Answer this question