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

IntValue doesn't change in the output?

So I have local Folder = Instance.new("Folder") Folder.Name = "leaderstats" Folder.Parent = player local Level = Instance.new("IntValue") Level.Name = "Level" Level.Parent = Folder

local qoroutine = coroutine.create(function() while true do print(Level.Value) wait(.1) end end) coroutine.resume(qoroutine)

Then i go to the folder and change the value of level, and it doesn't change in the output?

1 answer

✓ Accepted answer

The script is fine, the reason that your IntValue isn't changing is because you aren't changing the value on the server. If you change a value on a client, it doesn't replicate to the server. This is to prevent exploiters, let's say a hacker sets their cash to 10000000, the server would still see it as 0. To fix this you could either increment the value

local players = game:GetService("Players")

players.PlayerAdded:Connect(function(player)
	local Folder = Instance.new("Folder") 
	Folder.Name = "leaderstats" 
	Folder.Parent = player 

	local Level = Instance.new("IntValue") 
	Level.Name = "Level" 
	Level.Parent = Folder

	local qoroutine = coroutine.create(function() 
		while true do
			Level.Value += 1 -- Incrementing the value every 0.1 seconds (10/sec)
			print(Level.Value) 
			wait(.1)
		end 
	end)
	coroutine.resume(qoroutine)
end)

or you could just do this and change the value on the server

1 comment

0

thank you very much, i was really confused

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