Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to change int values?

Hello, I am trying to figure out how to add to an integer value at game.workspace.CORETEMP I want it to add a certain number to the value every few seconds forever. Thanks.

2 answers

You can add to integer values by using this:

local amount = 0 -- the amount you want to add

workspace.CORETEMP.Value = workspace.CORETEMP.Value + amount

To do what you want to do, make this:

local time = 0 -- the time it takes for the loop to start
local amount = 0 -- the amount you want to add

while wait(time) do
	workspace.CORETEMP.Value = workspace.CORETEMP.Value + amount
end

You can also create an instance, and change it via function.

local value = Instance.new("IntValue")
value.Parent = game.Workspace
 
value.Changed:Connect(function(NewValue)
    print(NewValue)
end)
 
value.Value = 20

This discussion is preserved as it was. New answers, comments, and votes are closed.