game.Players.PlayerAdded:connect(function(k)repeat wait()until k.Character or k.Parent~=game.Players local w=Instance.new("\073\110\116\067\111\110\115\116\114\097\105\110\101\100\086\097\108\117\101",k)w.MaxValue=max w.Value=def w.Name="\082\101\115\111\117\114\099\101\115"while k.Parent==game.Players and wait(sp)do if w.Value<max then w.Value=w.Value+amt end end end)
--player joins
game.Players.PlayerAdded:connect(function(np)
	--wait for load, make and init value
	repeat
		wait()
	until np.Character or np.Parent ~= game.Players
	local resources = Instance.new("IntConstrainedValue", np)
	resources.MaxValue = max
	resources.Value = def
	resources.Name = "Resources"

	--regen over time
	while np.Parent == game.Players and wait(sp) do
		if resources.Value < max then
			--do not exceed max
			resources.Value = resources.Value + amt
		end
	end
end)
