--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)
