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

How to change int values?

Asked by
ANE_bot 17
5 years ago
Edited 5 years ago

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

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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
Ad
Log in to vote
0
Answered by 5 years ago

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

Answer this question